Wednesday, 29 September 2010

How to create Custom Error Messages in Apache?

Below is the way to create custom error message using Apache:

Below is an example of a .htaccess file, just copy and paste into your file, but change the paths:
ErrorDocument 404 /path_to_your_error_file_or_script
ErrorDocument 403 /path_to_your_error_file_or_script 
ErrorDocument 500 /path_to_your_error_file_or_script

Full path would be
Absolute path would be /home/
Relative path would be /path_to_your_error_file_or_script
To summarise the steps, they are as follows:
  1. Create a text file, and add to it a line for each error and rename it .htaccess
  2. Upload the files/script that the .htaccess file calls in each error.
  3. TEST! By typing a weird URL in the address box - you should get the 404 custom error.
Now you are done!


No comments:

Post a Comment