How can I do this?

Oh, the strange things mod_rewrite does!

How can I do this?

Postby maineyak » Thu May 08, 2008 6:47 am

I am using a script that calls for the following rules:
Code: Select all
Options -Indexes
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .+ ./index.php [L]

The problem is, it conflicts with my customized 404 error page. I think the "RewriteRule .+ ./index.php [L]" conflicts with the "Options +Indexes" I'm supposed to add to make the 404 error page work. Is there a way to combine this all so it makes my 404 error page work? I would greatly appreciate someone's help with this. Thanks.
Posts: 1
Joined: Thu May 08, 2008 6:41 am

Postby richardk » Sun May 11, 2008 1:03 pm

That mod_rewrite matches all 404 requests (everything that isn't an existing file or directory). You will have to use more specific RewriteRules or make the index.php file output your custom 404 page.

As far as i know, Indexes has nothing to do with 404 (or other) errors, it just shows the directory listings for directories with no index page (instead of a forbidden error).
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Return to Idiosyncrasies

Who is online

Users browsing this forum: No registered users and 1 guest