Forum Moderators: phranque
For example. If you request:
www.example.com/abc but abc does not exist on my server, I would like to serve up:
www.example.com/missing.html which has a custom file not found message but I also want to send back a 404 status.
I tried to accomplish this with the following in .htaccess:
ErrorDocument 404 http://www.example.com/missing.html
This accomplishes serving up the error page but sends back a 302 found status.
Any thoughts on how to accomplish this would be appreciated. If this is something that can't be done, please let me know as well.
Thanks.
ErrorDocument 404 /missing.html
Jim
Jim, I tried using a local path and used the exact line you suggested:
ErrorDocument 404 /missing.html
When I tried that, it just give me the standard 404 through my browser and it could not find missing.html
I am not sure what it up. Because the local path is not working, does it point to something else perhaps being configured incorrectly.
Jim, you were right - I needed a local path. It did not work the first time because my error message, missing.html was less than 512 bytes. (I was just testing with a short error message.) With the link you gave to the apache error documentation, I found out that IE will ignore error messages shorter than 512bytes and use its own error message. That is why it did not appear to work the first time.
When I used the local path and made the error message longer, it served up the custom error page and the 404 response.
Thanks Jim, bsterz for your help. I love this place!