[drupal-devel] [bug] Fix 404 handling without clean URLs

Steven drupal-devel at drupal.org
Mon Aug 22 11:27:37 UTC 2005

Issue status update for 
Post a follow up: 

 Project:      Drupal
 Version:      cvs
 Component:    base system
 Category:     bug reports
 Priority:     normal
 Assigned to:  Steven
 Reported by:  Steven
 Updated by:   Steven
 Status:       patch (code needs work)

As far as I can tell, the issue is still there. I can't make an updated
patch atm. Either we need to check for a non-clean 404, or stop
intercepting non-clean 404s.

It affects setups where htaccess is being read, but mod_rewrite is not
installed or not working.


Previous comments:

Sun, 28 Nov 2004 15:08:31 +0000 : Steven

Attachment: http://drupal.org/files/issues/404.patch (1.07 KB)

When clean urls are enabled, non-existant pages are rewritten to
www.site.com/?q=non/existant. The menu handler will throw a 404 on the
non-existant Drupal path.

However, if clean urls are not active, then the 404 page (index.php) is
called as is. $GET['q'] will be empty, and the front page will be shown
without any indication of the 404 or without a log entry in the
watchdog. Note that this only happens if .htaccess is being read, but
mod_rewrite is not present or enabled. Not too common, but still a bug.

The attached patch fixes this problem by checking for a 404 in
index.php and calling drupal_not_found() if needed. It also sets
$_GET['q'] to request_uri(), so the 404'd URL shows up correctly in the
watchdog (same as the rewrite rule).

This should go in 4.5 as well as HEAD. Patch is for HEAD, but it should
apply to 4.5.


Sun, 28 Nov 2004 15:17:22 +0000 : Steven

An alternative solution is to drop the ErrorDocument 404 from .htaccess,
then the web server will handle them if there are no clean URLs. However
I think the intended behaviour is for Drupal to log all 404s.


Sun, 13 Mar 2005 20:44:58 +0000 : killes at www.drop.org

Doesn't apply anymore.


Fri, 19 Aug 2005 13:53:59 +0000 : killes at www.drop.org

Steven what's up with this?

More information about the drupal-devel mailing list