Drupal can generate fully themed 404 pages. However, some of these responses are for images or other resource files that are not displayed to the user.This can waste bandwidth, and also generate server load. This for this reason, drupal has Fast 404 pages that return a simple, fast 404 page for URLs matching a specific pattern.

File: sites/default/default.settings.php
Line: 485

Files: 
CommentFileSizeAuthor
#33 html5-fast404-33.patch2.11 KBPere Orga
PASSED: [[SimpleTest]]: [MySQL] 39,548 pass(es).
[ View ]
#31 html5-fast404-31.patch1.87 KBPere Orga
PASSED: [[SimpleTest]]: [MySQL] 39,563 pass(es).
[ View ]
#27 html5-fast404-27.patch1.86 KBkid_icarus
PASSED: [[SimpleTest]]: [MySQL] 41,311 pass(es).
[ View ]
#27 interdiff.txt1.68 KBkid_icarus
#25 html5-fast404-25.patch1016 byteskid_icarus
PASSED: [[SimpleTest]]: [MySQL] 41,301 pass(es).
[ View ]
#22 1436814-html5-suggestion-22.patch966 bytesandypost
PASSED: [[SimpleTest]]: [MySQL] 39,401 pass(es).
[ View ]
#16 doctype.patch1.01 KBdroplet
PASSED: [[SimpleTest]]: [MySQL] 39,124 pass(es).
[ View ]
#8 html5-fast404.patch903 byteswebchick
PASSED: [[SimpleTest]]: [MySQL] 36,666 pass(es).
[ View ]
#6 1436814-fastHtml5page-5.patch909 bytesgary4gar
PASSED: [[SimpleTest]]: [MySQL] 34,270 pass(es).
[ View ]
#1 1436814.patch894 bytesgary4gar
PASSED: [[SimpleTest]]: [MySQL] 34,257 pass(es).
[ View ]

Comments

Status:Active» Needs review
StatusFileSize
new894 bytes
PASSED: [[SimpleTest]]: [MySQL] 34,257 pass(es).
[ View ]

here is the silly Patch that changes the DOCTYPE to HTML5

Assigned:gary4gar» Unassigned
Priority:Minor» Normal

I question why it never had a doctype in the first place, and whether we should add one now.

Earlier doctype was xhtml & I have now switched it to html5. Besides, doctype is recommended for any HTML document to enforce standards mode.

I don't see a doctype, unless it's added somewhere else that's quirksmode for you right there. <!doctype html> would help.

Status:Needs review» Needs work

Status:Needs work» Needs review
StatusFileSize
new909 bytes
PASSED: [[SimpleTest]]: [MySQL] 34,270 pass(es).
[ View ]

My Bad! here is the correct version :)

Status:Needs review» Needs work
Issue tags:+html5

Please write it this way, so it's consistent with html.tpl.php: <!DOCTYPE html>.

Thanks!

Status:Needs work» Needs review
StatusFileSize
new903 bytes
PASSED: [[SimpleTest]]: [MySQL] 36,666 pass(es).
[ View ]

Hey, I can do that! :P

Verified at http://validator.w3.org/check

Status:Needs review» Reviewed & tested by the community

Sweet :D Thanks!

Status:Reviewed & tested by the community» Needs work
Issue tags:-html5

The last submitted patch, html5-fast404.patch, failed testing.

Status:Needs work» Needs review
Issue tags:+html5

What the what? I am not sure how changing an HTML string causes the managed files table to not be found. :P Re-testing.

#8: html5-fast404.patch queued for re-testing.

Status:Needs review» Reviewed & tested by the community

There we go.

Re-RTBCing because it was RTBCed by Jacine in #9 before the random testbot freakout.

Recently, I found IE served default error page to users (http://www.404-error-page.com/404-error-page-too-short-problem-microsoft...)

so if our purpose is make it faster, I think we don't need to output any custom strings. 404 error header is good enough.

Status:Reviewed & tested by the community» Fixed

Committed to 8.x. Thanks.

Status:Fixed» Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Version:8.x-dev» 7.x-dev
Status:Closed (fixed)» Needs review
Issue tags:+Quick fix, +Novice
StatusFileSize
new1.01 KB
PASSED: [[SimpleTest]]: [MySQL] 39,124 pass(es).
[ View ]

Add it back to D7

Status:Needs review» Reviewed & tested by the community

Tested on drupal 7 - works fine. I get following doctype:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.0//EN"
  "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd">

Version:7.x-dev» 8.x-dev
Status:Reviewed & tested by the community» Fixed

Hm. I don't think we can backport this to D7. We can't change core's markup, or we risk breaking themes.

But thanks for uploading the patch; I'm sure someone out there will find it useful!

It looks like the only change in the D7 version is the added doctype, which should have been there in the first place. Could this break existing themes in some way?

Yes, because existing themes are XHTML in D7.

Version:8.x-dev» 7.x-dev
Category:bug» feature
Status:Fixed» Needs review
StatusFileSize
new966 bytes
PASSED: [[SimpleTest]]: [MySQL] 39,401 pass(es).
[ View ]

Just in case of changing to recommended defaults for HTML5, this could be useful to make a life a bit easy :)

Title:Switch to HTML5 for Fast 404 "Not found" pagesFast 404 "Not found" pages are missing a doctype
Category:feature» bug

The issue title here is inaccurate for the patch in #16 that was originally posted for Drupal 7... That confused me a lot :)

Since #16 just fixes a missing doctype, it actually seems like it should be backportable to me. Correct me if I'm wrong, but I think this string of HTML is impossible to theme (as in, literally impossible because there is no CSS or styles added to the page)? If so, then we don't have to worry about that either.

Version:7.x-dev» 8.x-dev
Status:Needs review» Needs work

Oh, but first of all, wait. The Drupal 8 patch was actually incomplete, because there's still this left over in bootstrap.inc:

<?php
      $fast_404_html
= variable_get('404_fast_html', '<html xmlns="http://www.w3.org/1999/xhtml"><head><title>404 Not Found</title></head><body><h1>Not Found</h1><p>The requested URL "@path" was not found on this server.</p></body></html>');
?>

Status:Needs work» Needs review
StatusFileSize
new1016 bytes
PASSED: [[SimpleTest]]: [MySQL] 41,301 pass(es).
[ View ]

Since #8 has already been committed, I think this should do the trick.

After the patch, this grep returns no results :)
grep -r '404' . | grep 'html xmlns="http://www.w3.org/1999/xhtml'

Hm, wait a second, is this missing an opening <html> tag (after the doctype)? And same question goes for the original commit?

StatusFileSize
new1.68 KB
new1.86 KB
PASSED: [[SimpleTest]]: [MySQL] 41,311 pass(es).
[ View ]

Indeed both patches are missing an opening <html> tag.

It struck me as odd, but since #8 was committed I reasoned that it was done intentionally and made a similar edit. I should have listened to my inner wtf. Here is a patch which addresses #26.

#26, 27,
Nope. Although it may not a good habit, <html>start tag can be omitted in HTML5.

#27 patch looks good.

Status:Needs review» Reviewed & tested by the community

+1 to RTBC

Version:8.x-dev» 7.x-dev
Status:Reviewed & tested by the community» Patch (to be ported)

Committed/pushed to 8.x.

I'm going to disagree with webchick in #19 - the fast 404 pages aren't themable at all (unless you hack the variable yourself), so this should be OK to backport.

Status:Patch (to be ported)» Needs review
StatusFileSize
new1.87 KB
PASSED: [[SimpleTest]]: [MySQL] 39,563 pass(es).
[ View ]

Patch attached.

Status:Needs review» Needs work

We shouldn't change Drupal 7 markup to HTML5, should we? It should remain XHTML.

Status:Needs work» Needs review
StatusFileSize
new2.11 KB
PASSED: [[SimpleTest]]: [MySQL] 39,548 pass(es).
[ View ]

Ok.

Status:Needs review» Reviewed & tested by the community

Looks good to me. W3C Validator warns that it doesn't declare its encoding, but it's not an error.

Thanks.

Yes. The same warning should appear on 8.x.
But even the '404' pages of validator.w3.org (such as http://validator.w3.org/notfound) don't specify the encoding.

Status:Reviewed & tested by the community» Fixed
Issue tags:+7.17 release notes

Looks good - committed to 7.x. Thanks! http://drupalcode.org/project/drupal.git/commit/8a4df80

Automatically closed -- issue fixed for 2 weeks with no activity.