PDA

View Full Version : How To Use Error Pages


James
07-12-2005, 09:11 PM
Ever visited a website and you are looking for a certain file/folder and get an error 404 ?

404 is a way of letting the user know that either 1. The file/folder has been moved 2. Deleted 3. misplaced (or not yet available).

You yourself can make you own error pages by following these simple instructions.

First you will need to login to CPanel by going to your website eg. http://www.yourdomain.com/cpanel yourdomain.com being your domain name you use.

Next you will see the Error Pages link (under a Notepad image) click on the image or the link below it.

Next you will see the following text - With this tool you can create custom error pages to display when a user enters a wrong URL, an outdated URL or when the user is not authorized to access a specific directory of your web space.

Under the text above you will see - 400 (Bad request), 401 (Authorization required), 403 (Forbidden), 404 (Wrong page) & 500 (Internal server error).

Click on the 400 (Bad request), 401 (Authorization required), 403 (Forbidden), 404 (Wrong page) & 500 (Internal server error) image and this will take you to the next screen where it will allow you to edit the 400 (Bad request), 401 (Authorization required), 403 (Forbidden), 404 (Wrong page) & 500 (Internal server error) pages so when users run into errors on your website it will show them the error you want them to see incase something occurs throughout your website.

Here is a sample code.


<HTML>
<HEAD>
<TITLE>Error 400 - Bad Request</TITLE>
<BODY>
<CENTER>
Sorry the request could not be understood by the server due to malformed syntax.<br>
Please try again soon or please email me <a href="mailto:example@domain.com">here</a>
<p></p>
Thanks for Visiting come back soon.
</CENTER>
</BODY>
</HTML>


Note that the error 400 example above can be changed to what you want it to say. This is a simple example more advanced users can create whatever they want.

Also there are some other neat options that you can add.

1. Referring URL (Where they come from)
2. Visitor's IP Address (The visitors IP Address they connected with)
3. Requested URL (The URL/File/Folder they requested)
4. Server name (The Server's Name)
5. Visitor's Browser (What browser they are using)
6. Redirected Status Code (How they were redirected)

You can add each one of these as you wish.

Here is an example


<HTML>
<HEAD>
<TITLE>Error 400 - Bad Request</TITLE>
<BODY>
<CENTER>
Sorry the request could not be understood by the server due to malformed syntax.<br>
Please try again soon or please email me <a href="mailto:example@domain.com">here</a>
<p></p>
Thanks for Visiting come back soon.
<p></p>
You Come From Here: <!--#echo var="HTTP_REFERER" --><br>
Request URL: <!--#echo var="REQUEST_URI" --><br>
Your IP: <!--#echo var="REMOTE_ADDR" -->
</CENTER>
</BODY>
</HTML>


The code above will tell the user(s) How they got to the page where the error occured. The URL they requested & there IP address.

Once again you can edit the sample above to your liking as i have done with my own website (Sample http://matrixrevolutions.net/test (http://matrixrevolutions.net/400.shtml))

You could also research how some others have created theres.

Once you have done your editing click on the Save down the bottom of the page and that's done.

Next you will see the following screen Error page saved this means that the error page you worked on has been saved. You will also notice a new file in your public_html folder on the server this is normal as it's saved there for you once saved.

You can easily upload your own error pages by editing the pages on your home/office pc and uploading the files via FTP. You can save these error pages as PHP, HTML etc however doing the editing with CPanel will save them as .shtml this can be changed by editing the extension it is saved as where the text Save as: (Text Box with 404.shtml etc) simply edit it to 404.html 404.php etc and click Save.

However with the sample code showing how the user got there there IP address etc will need the error page to be saved as .shtml.

After you have saved the file click Go Back and this will take you to the default page to let you edit another error page.

Next you can try it out depending on the error a 404 error is best for this test.

Simply go to your website http://yourdomain.com and place a file name or folder you know is not there at the end of the URL and then press ENTER the error 404 page should come up this will let you see how the page had turned out :).

If you would like some help let me know and i will help you design an error page to my best :)