so i want to set default error pages for my website, but im having trouble with setting the default 404 page (i havent done any others yet). i am running a lamp server, and put the .htaccess in the root of it (/var/www) and put in it ErrorDocument 404 /error/error404.php but when i type in localhost/inde.php (which doesnt exist) i still get the error 404 page generated by i think apache

3 Years
Discussion Span
Last Post by TheJeffMatson

thanks but it didnt help. it just told me to put a .htaccess file in root which ive done already


warren i appreciate the help but just throwing guides at me isnt going to help i have followed them to the t except for the location of the page. i need someone to tell me what im doing wrong. update: ive tried localhost/error/error404.php and that with a / at the beginning


The location defined in your .htaccess file will be based on where your document root is as well as where the error document is located.

For example, I see that you have placed your error document in /var/www/error/error404.php

Based on this, you will define the following in your .htaccess file located in /var/www/:
ErrorDocument 404 /error/error404.php

Be sure that when you test it, that your browser cache is clear as well.

Jeff Matson
InMotion Hosting


In addition, if for some reason that causes issues, you could have an outside variable defined in your Apache httpd.conf file that is effecting it. Also check your Apache error logs for lines relating to your error documents. Apache error logs can be in different places depending on how you installed it, but check the following:


Jeff Matson
InMotion Hosting

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.