Jump to content

Using .htaccess For Error Pages


TCH-Sales

Recommended Posts

Setting up your error documents through the .htaccess file is easier than one might think. Here’s an example of what you would want to cut and paste into your .htaccess file:

 

>ErrorDocument 400 /errors/400.html
ErrorDocument 401 /errors/401.html
ErrorDocument 403 /errors/403.html
ErrorDocument 404 /errors/404.html
ErrorDocument 500 /errors/500.html

 

This tells the server that each of these errors pages are in the /errors/ folder and the exact file that needs to be seen when somebody encounters that error.

 

Each line represents one error. For example, this

 

>ErrorDocument 404 /errors/404.html

 

is the line for a 404 error, or the message you get when a page can not be found. You can change the path of the file you want the user to go to when they run into the error as well. Just change the “/errors/” to another path like “/static_pages/404.html”.

 

If you need to get more information on customizing your 404 error page, please check out this thread from the cPanel forms.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...