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.

Comments

inducer@news.tiker.net’s picture

I forgot to mention that this is implemented as a third value ("2") of the clean_url system variable, which can be interactively selected (and is documented) in the setup screen.

chx’s picture

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.

inducer@news.tiker.net’s picture

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.

inducer@news.tiker.net’s picture

StatusFileSize
new365 bytes

CVS diffs cannot include new files, unfortunately, so the added file 404.php was missed. I've attached it to this comment, you need to drop it into the main directory.

killes@www.drop.org’s picture

The patch doesn't fully apply anymore.

morbus iff’s picture

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*.

Crell’s picture

Version: » 5.x-dev
Status: Active » Closed (won't fix)

Breaking normal 404 functionality is a bad thing. Plus, this is way old. :-)