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

Recommended Answers

Did you make sure that you have your custom error404 page in the correct directory?

Jump to Post

All 10 Replies

Did you make sure that you have your custom error404 page in the correct directory?

yep. its at /var/www/error/error404.php

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

thats the one i used to setup my error page

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.