Forum Moderators: phranque

Message Too Old, No Replies

Can I rewrite ErrorDocument?

         

FalseDawn

11:14 pm on May 1, 2005 (gmt 0)

10+ Year Member



Eg if I have:
ErrorDocument 404 /404page

Is there any way to then rewrite this using (eg)
RewriteRule ^404page$ 404page.php

I've tried a few variations and keep getting looping.

jdMorgan

3:39 am on May 3, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Do you have Options MultiViews enabled? Are you using MultiViews? If you don't need MultiViews enabled, turn them off, as this is often a cause of mysterious server behaviour such as confusing "404page" with "404page.php".

You can disable MultiViews in httpd.conf, or add "-MultiViews" to any existing Options in your .htaccess file, e.g.


Options +FollowSymLinks -Indexes -MultiViews

Your code is basically sound, except that I would recommend that you "root" 404page.php, and add an [L] flag to the rule to stop further rule processing if the rule matches and does the rewrite:

RewriteRule ^404page$ [b]/4[/b]04page.php [b][L][/b]

Unless the fact that 404page.php was not rooted was causing a problem, your code should not have looped -- which is why I asked about MultiViews.

Jim