TechNdo - Blogger tips, tricks, tutorials and widgets

Latest News

Sunday 5 May 2013

How to Create 404 error page in HostGator?




404 error pageClient request error pages and also server error pages are two ways to control how a website responds to a request. Errors like 400 (bad request) 403 (Forbidden) and 404 (Not found) and several others help developers to provide better user friendly environment to help visitor to navigate the site better. In our tutorials we will now be also discussing Hostgator webhosting tips and guides  to help new web owner with general problems. 







To learn how to create error page for blogger please read: 404 Error Page in Blogger

Types of Error Pages

For a corporate website with millions of pages, each and error page needs to be created to alert the user when goes wrong. But if you are running a small business site like ours then you just need to create a 404 page which will tell visitors that they have landed on a page that has either been deleted or is broken. 
Following are some common types of error pages:
Client Request Errors:
400 - Bad Request
401 - Authorization Required
403 - Forbidden
404 - Not Found
405 - Method Not Allowed
406 - Not Acceptable (encoding)
407 - Proxy Authentication Required
408 - Request Timed Out
409 - Conflicting Request
410 - Gone
411 - Content Length Required
412 - Precondition Failed
413 - Request Entity Too Long
414 - Request URI Too Long
415 - Unsupported Media Type
Server Errors
500 - Internal Server Error
501 - Not Implemented
502 - Bad Gateway
503 - Service Unavailable
504 - Gateway Timeout
505 - HTTP Version Not Supported

Create 404 Not Found Page

By default you see a HostGator error page if you have not setup your custom 404 page. To create a an error page you will first need to design it. Use Dreamweaver or ask your designer to create a 404 error page. The error page will have exact same structure and stylesheet as your main page. Take a look at our error page to get an idea. You are welcomed to use our style sheet for non-commercial use by visiting the source page. Once you have created that, copy the entire code from that page either straight from Dreamweaver or by viisting the browser source page. Then follow these steps:
  1. Go To Hostgator Cpanel
  2. In the search box type "error pages"
  3. Click the error pages icon
  4. Select the domain for which you wish to create the page
  5. Click the edit icon next to 404 (not Found)
  6. Inside the editor Paste your entire code
  7. Hit Save and you are all done!
error page editor
You will also see tags that you can insert. These tags are a total six which include:
1. Referring URL. :
<!--#echo var="HTTP_REFERER" -->
This tag if inserted anywhere will tell the visitor from where he came from

2. Visitor's IP Address
<!--#echo var="REMOTE_ADDR" -->
This tag will tell visitors remote address.
3. Requested URL
<!--#echo var="REQUEST_URI" -->
This tag will display the link the user typed in the address bar that brought him to the error page.
4. Server Name
<!--#echo var="HTTP_HOST" -->
This tag will display the domain address or Homepage URL
5. Visitor's Browser
<!--#echo var="HTTP_USER_AGENT" -->
This as the name suggests displays the name of visitor's browser.
6. Redirect Status Code
<!--#echo var="REDIRECT_STATUS" -->
This will tell visitors which type of error page is this.

Troubleshooting

There are 70% percent chances that you will still see the default Hostgator error page. To solve this problem we just need to insert two missing lines of code inside .htaccess file of your file directory. Its really simple just follow these steps:
  1. Inside your control panel click the File Manager icon
  2. Choose public_html directory
  3. Once the File Manager loads navigate to .htaccess file.
  4. Click the edit button from top to open this file
  5. Back up the file first and then insert this code inside it
.htaccess file
ErrorDocument 403 /403.shtml
ErrorDocument 404 /404.shtml
ErrorDocument 500 /500.shtml
     6.  Save the file and you are all done!
Now visit your website and type anything after the page url to make the 404 error message display.

Need help?

Please don not hesitate to ask as many questions as possible. I just hope this helps most of you in creating error request pages to breath a new life in your web and provide a better user experience. Take good care of yourselves. Peace and blessings buddies :)





  • Blogger Comments
  • Facebook Comments

0 blogger-facebook:

Post a Comment

Item Reviewed: How to Create 404 error page in HostGator? Description: Rating: 5 Reviewed By: Ajay
Scroll to Top