Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Custom 404 messages?

Status
Not open for further replies.

truckster

Technical User
May 1, 2003
4
AU
Can this be done in Apache?

Ive been told I just have to fine the command and add it to the httpd.conf file

Anyone help out here?

Thanks
Bruce.
 
The [tt]ErrorDocument[/tt] directive tells Apache where to serve error pages from. For example:
[tt]ErrorDocument 404 /my-custom-404.html[/tt]
would tell Apache to serve [tt]<your web root>/my-custom-404.html[/tt] each time it encounters a 404 error.

//Daniel
 
You can also define your custom 404 file location on a site by site/directory by directory basis using the .htacces file.

See the documentation for full details.

However otherwise its simple to either define it as danielhozac describes, OR even! you can write it as a &quot;one&quot; line of html in the httpd.conf as in:

ErrorDocument 404 <http><head><title>My Four Oh Four</title></head><body>Sorry you have come to a 404 page, please use your back button to return ....</body></html>

And you can use inline formatting, !there is a restriction on the length of the line though!.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top