August 11th, 2012, 07:56 PM
Designing my own error 404 - page not found
when i type incorrect url in my browser, i want apache to redirect to my own 404 error page - page not found
this is the line of code in the httpd.conf file i edited
ErrorDocument 404 errors/FileNotFound.html
But it doesnt work
I even created a .htaccess and insert the same line of code, but still its not working,can some please assist
August 11th, 2012, 10:00 PM
It's easier in the .htaccess, not the httpd.conf.
In that httpd.conf, or in the definition for your VirtualHost, did you enable AllowOverride? Also, post the definition of your site (either the VirtualHost or the default) and the contents of the .htaccess.
August 13th, 2012, 04:21 AM
Thanks for replying
Originally Posted by requinix
I am not 100% sure where the .htaccess file should go, i tried several places still not working.
i have just set the allowOverride to ALL - Still not working
This is the content of my .htaccess file
ErrorDocument 404 errors/filenotfound.php
Not sure about your other question regarding virtualhost
August 31st, 2012, 05:43 PM
What error message do you get when you point the browser to a file that does not exist? Does it contain a line like:
'A 404 error was found when trying to use an ErrorDocument do handle the request.'
If this is not there, then the server may not be interpreting your directives. Remember you need to restart the server every time to edit httpd.conf.
If it is there, try changing the directive to
ErrorDocument 404 /errors/filenotfound.php
The first slash tells the server to look from the ServerRoot directory for the file, instead of in the non-existent directory. With your current directive, if you request the page "/foo/bar/index.php", the server will look look for /foo/bar/errors/filenotfound.php which obviously doesn't exist. Changing the ErrorDocument to above will make the server look in "/errors/filenotfound.php" which is what you want.
Hope that helps.