on an apache server, you can add the following line to the .htaccess file in the root of your web server:
ErrorDocument 404 /404error.php
The last portion is the file that will get called anytime the server detects a 404 error. (the same thing can be done for a 403 error; permission denied). This can be a static web page or a scripted page. A few things to consider:
1. This file does not always get called from the root directory, so always reference the page off of the root. (/404error.php instead of just 404error.php in my example)
2. Also since this can get called from other directories, make sure all images/css/script files you reference are based off of the root directory (
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.
Greg K posted this at 04:53 — 18th August 2007.
He has: 2,145 posts
Joined: Nov 2003
on an apache server, you can add the following line to the .htaccess file in the root of your web server:
ErrorDocument 404 /404error.php
The last portion is the file that will get called anytime the server detects a 404 error. (the same thing can be done for a 403 error; permission denied). This can be a static web page or a scripted page. A few things to consider:
1. This file does not always get called from the root directory, so always reference the page off of the root. (/404error.php instead of just 404error.php in my example)
2. Also since this can get called from other directories, make sure all images/css/script files you reference are based off of the root directory (
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.