Clean URLs via ErrorDocument
inducer@news.ti... - January 4, 2005 - 21:46
| Project: | Drupal |
| Version: | 5.x-dev |
| Component: | base system |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | won't fix |
Description
The attached patch adds the possibility to have clean URLs solely by pointing the ErrorDocument 404 directive at the supplied (short) 404.php file. HTTP POST requests will, of course, not work this way, and are appropriately directed to the regular index.php?q=something address. The code also makes sure that the appropriate response code is set in each case. (i.e. pages do not arrive with a 404 status)
The patch also changes HTTP status setting in several places to header("Status: NNN Message") instead of header("HTTP/1.0 NNN Message"). The former did not work for me.
| Attachment | Size |
|---|---|
| drupal-4.5.1-clean404-2005-01-04-v3.patch | 8.28 KB |

#1
I forgot to mention that this is implemented as a third value ("2") of the
clean_urlsystem variable, which can be interactively selected (and is documented) in the setup screen.#2
Features are not going into 4.5, that's in bugfix mode, so please check whether this patch applies to HEAD and change the version accordingly.
I hesitate to +1 this. Is this necessary ie. are there so many hosting providers with .htaccess but without mod_rewrite support? The big problem I have faced many times is the lack of .htaccess support at cheap or free providers.
I'd recommend that you pick out the header("HTTP/1.0 NNN Message") header lines and resubmit that as a patch with category bug. That's a totally different beast.
#3
Turns out that the
header()issue is fixed in CVS. Find attached an updated version of the patch that applies to current CVS cleanly.http://mamboforge.net/projects/sef404/ lists the corresponding project for Mambo.
#4
CVS diffs cannot include new files, unfortunately, so the added file
404.phpwas missed. I've attached it to this comment, you need to drop it into the main directory.#5
The patch doesn't fully apply anymore.
#6
Big -1 from me. We shouldn't piggyback or overload status code 404 with the brunt of our operation. That's obscene and just downright *wrong*.
#7
Breaking normal 404 functionality is a bad thing. Plus, this is way old. :-)