Forum Moderators: phranque

Message Too Old, No Replies

htaccess custom 404 error - php and html

         

xinfinityz

6:41 am on Feb 23, 2005 (gmt 0)



Well I'm fairly new to the whole .htaccess thing so forgive me if I'm just being an idiot. I have .htaccess set up in my root with only the following lines:

ErrorDocument 400 /error400.php
ErrorDocument 401 /error401.php
ErrorDocument 403 /error403.php
ErrorDocument 404 /error404.php
ErrorDocument 500 /error500.php

When I goto an invalid page that has the extension .php, my custom 404 page doesn't come up and instead I see the host's default 404. However, if I put in any other invalid page (including one with a totally made up extension such as jojo.foobar) my custom 404 comes up. Why is this and how do I fix this?

I've looked around and played with some Addtype but nothing seems to help.

jdMorgan

5:47 pm on Feb 23, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



xinfinityz,

Welcome to WebmasterWorld!

Strange problem...

In order to use AddType, your FileInfo override must already be active, and AllowOverride FileInfo is the only dependency I can find for ErrorDocument.

The only thing I can think of is that the php content-handler is being activated before some other critical link in the chain. Make sure that you have loaded the php module very earlier in the LoadModule list; It should be among the first modules loaded. Apache give reverse-priority to modules -- the first loaded are the last to run. Therefore, the php interpreter *may* be interfering with error handling.

This is just a guess, but we get a lot of questions due to the fact that people assume that they should just add php to the *end* of the list. This causes mod_rewrite and mod_auth and a bunch of other modules to appear to fail, because php then runs first before they can have any effect.

I'd suggest double-checking your AllowOverride setting and your LoadModule order, at least until someone who's seen this problem before drops in here and reads this thread...

Jim