0
votes

Am using COdeigniter.. I have a .htaccess. ANd the problem is that the server when access www.example.com/notfoundimage.png which is not available on server, should redirect it to .404htm (designed error document template)... however instead, it gives a server error

HTACCESS:

ErrorDocument 404 /404.htm 
ErrorDocument 400 /404.htm
ErrorDocument 403 /404.htm

ErrorDocument 500 /404.htm

Error when accessing non-existent file www.example.com/notfoundimage.png

Server error The website encountered an error while retrieving http://www.example.com/notfoundimage.png. It may be down for maintenance or configured incorrectly.

If i comment this line from htaccess

ErrorDocument 404 /404.htm

The error 404 (which should be) comes up. But i need the above line to redirect 404 to my template page: 404.htm

3
Look at the apache error logs and see if you find a more meaningful error message. - Salman A
What happens when you access example.com/404.html directly? - Socken Puppe

3 Answers

1
votes

This server could not verify that you are authorized to access the document requested. Either you supplied the wrong credentials (e.g., bad password), or your browser doesn't understand how to supply the credentials required.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

0
votes

I didn't think mod_rewrite would rewrite the ErrorDocument files, but I might be wrong. This is untested, but you can quickly test by putting this very early in your mod_rewrite section:

RewriteCond  %{REQUEST_FILENAME}  -f
RewriteRule  .*                   -     [L]

If that has no effect, then just remove it. Do also check that it does not break anything! (I'm sure it could be shortened to one line, but it's just the style that I use in mod_rewrite).

0
votes

Make sure your files have read permissions, and also, try .html file extensions.