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

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

gary4gar’s picture

Status: Active » Needs review
FileSize
894 bytes

here is the silly Patch that changes the DOCTYPE to HTML5

Everett Zufelt’s picture

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.

gary4gar’s picture

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

nod_’s picture

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

droplet’s picture

Status: Needs review » Needs work
gary4gar’s picture

Status: Needs work » Needs review
FileSize
909 bytes

My Bad! here is the correct version :)

Jacine’s picture

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

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

Thanks!

webchick’s picture

Status: Needs work » Needs review
FileSize
903 bytes

Hey, I can do that! :P

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

Jacine’s picture

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.

webchick’s picture

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.

webchick’s picture

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.

droplet’s picture

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.

Dries’s picture

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.

droplet’s picture

Version: 8.x-dev » 7.x-dev
Status: Closed (fixed) » Needs review
Issue tags: +Quick fix, +Novice
FileSize
1.01 KB

Add it back to D7

cweagans’s picture

intergalactic overlords’s picture

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">
webchick’s picture

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!

Tor Arne Thune’s picture

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?

webchick’s picture

Yes, because existing themes are XHTML in D7.

andypost’s picture

Version: 8.x-dev » 7.x-dev
Category: bug » feature
Status: Fixed » Needs review
FileSize
966 bytes

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

David_Rothstein’s picture

Title: Switch to HTML5 for Fast 404 "Not found" pages » Fast 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.

David_Rothstein’s picture

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:

      $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>');
kid_icarus’s picture

Status: Needs work » Needs review
FileSize
1016 bytes

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'
David_Rothstein’s picture

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

kid_icarus’s picture

FileSize
1.68 KB
1.86 KB

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.

droplet’s picture

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

#27 patch looks good.

andypost’s picture

Status: Needs review » Reviewed & tested by the community

+1 to RTBC

catch’s picture

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.

Pere Orga’s picture

Status: Patch (to be ported) » Needs review
FileSize
1.87 KB

Patch attached.

barraponto’s picture

Status: Needs review » Needs work

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

Pere Orga’s picture

Status: Needs work » Needs review
FileSize
2.11 KB

Ok.

barraponto’s picture

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.

Pere Orga’s picture

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.

David_Rothstein’s picture

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.