You use ErrorDocument like so:
ErrorDocument <3-digit-code> <action>
The <3-digit-code>
is a HTTP response status code (eg. "404").
And you have three types of <action>
that are triggered by what you type:
- If the action begins with a "/": A local path to redirect to.
- If the action is a valid URL: An external URL to redirect to.
- If neither of the above: Text to be displayed. (The text must be wrapped in quotes (" ") if it consists of more than one word.)
For example:
Local path:
ErrorDocument 404 /local/path/to/404.php
External URL:
ErrorDocument 404 http://external_url.example.com/server_error.html
Custom text:
ErrorDocument 404 "Oops! We can't find that pesky file. Sorry."
You've chosen a local path, but are probably not pointing correctly to the file from the server's perspective. Note that local server paths are not what you see in your URL, and often include things like ~/htdocs/www/domainname/
.
The problem is most likely that your path to 404.php
is wrong, and cannot be found by your server.