Custom error pages

Before you read this article, why not watch the movie tutorial instead?

To create a custom error page for your account, please login to cPanel and click Error Pages, under Advanced. Select the domain or subdomain you want and click the page you want to edit. Insert your own custom page code (in HTML or SHTML). The changes will be applied after you click Save.

But I don't know any HTML

Never fear. If you use a design program like Sitebuilder, simply publish a page which you would want to use. Next, visit your website online and pull up that new page you want. At the top of your browser, go to View and choose "Source" or "Page Source". Copy everything from the pop-up window (right click, Select All, right click, Copy) and now you can paste where the HTML code belongs.

Afterward, you may want to remove that extra page from your site builder program.


Common problems

If you are still seeing the HostGator error pages, try refreshing your browser (ctrl + F5). If you still see the HostGator pages, please add this code to your .htaccess file in the public_html directory.

ErrorDocument 403 /403.shtml
ErrorDocument 404 /404.shtml
ErrorDocument 500 /500.shtml

You can even use existing pages as the resulting page. Say you don't want any visitors seeing 404 errors on your site. You can make your home page the result, like so:

ErrorDocument 404 /index.html

If Internet Explorer is not displaying the custom error page, it is likely because the error page must be larger than 1 kilobyte.

There are many error pages which may be defined.

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

How can I revert back to the default error pages?

Simply delete the error page from the public_html folder:
404.shtml
403.shtml
500.shtml

Article Comments

Phil
The instructions above say, "If you still see the HostGator pages, please add this code to your .htaccess file in the public_html directory."

What if there is no .htaccess file in the public_html directory?

HostGator
Go to your public_html and create a new file named .htaccess , then edit that file.

Phil
How do you make custom error pages for add-on-domains?

HostGator
Exactly the same method, except you put the .htaccess and error page files inside the public_html/addondomain.com/ folder.

ver
Am trying to find where to save the customized suspended page of a reseller account, any idea?

HostGator
You must save that in your /public_html/suspended.folder/ directory. The page should be named index.html or index.php .

Andy
I have followed all of the above steps but when i add the .htaccess file to the directory, it tells me that there is a database connection error and the whole site goes down.

I even tried different combination to see if that would work but it hasn't.

First i edited the 404 page in cpanel, still same hostgator message
Then i added and edited the .hkaccess file and i get an error message.
I even created a 404 page and added it to the directory but still nothing.
Any help would be appreciated

HostGator
Adding this code will not cause a database connection error. You may have added the lines to other existing lines, or you may have forgotten an important piece of the code, like the forward-slash before the file name.

Please contact HostGator via phone or live chat, so that we can have a look.

paul
Hi
I have set up a page from within the cpanel and even set up the following code in the .htaccess file ErrorDocument 404 /404.shtml but it re-directs the error page to my blog! Any reason why it would do this?

HostGator
There are too many possibilities. Please contact us via email, phone or live chat for fast assistance.

J Vandiveer
AWESOME! Thanks ;)

Jared
okay im trying to create an .htaccess file but every time i do. It tells me the file already exists, but i looked all over there isn't any file there by the name .htaccess? help!

HostGator
Go to cPanel and click the "reset all interface settings" link at the bottom. Then click File Manager, and in the pop-up, select the checkbox for "show hidden files".

Now you can see the existing .htaccess file and edit it.

If you still have problems, please contact us via email, phone or live chat for assistance.

Scotty G the Webmaster
How do I embed flash in the custom error page? What path do I use to call the flash file? ...and where can I put the flash file itself?

HostGator
That is a very loaded question. If you need more help than I am including in this comment, please contact us via email, phone or live chat for assistance.

You need to upload the file into your domain's document root folder. For your primary domain, the folder is public_html.

Next, you need to research the HTML code which will embed the flash.

Finally, you can add that code to the custom error page. You call the flash file by its plain name.

EXAMPLE

<object width="500" height="500">
<param name="movie" value="name.swf">
<embed src="name.swf" width="500" height="500">
</embed>
</object>

Ben M
If you do not wish to use HostGator's error pages (the ones that advertise their service with a coupon code), AND you don't want to be forced to create and use Custom error pages, you can still use Apache's default error pages.

Simply edit your .htaccess file (in public_html), and point the error to root.

Example:
ErrorDocument 404 /

menno berndsen
Hi, I used

ErrorDocument 404 /index.html

which works, however , as you can see my social bookmarks are set to 0 recommendations, as the actual html page is not index.htm, so i updated it to

ErrorDocument 404 /http://www.domain.com

but this does not work.

Can somebody explain to me how the social bookmarks works on the error 404 page

HostGator
It appears the addthis_toolbox only works for http://domain.com/.

It does not work when I visit http://domain.com/index.htm and http://domain.com/index.html .

This leads me to believe it is a problem with the addthis tools, and not related to the error page code.

Rich
Step by step instructions for custom 404 page.

Create and upload the page you want errors to take your visitors to (e.g. error.shtml or index.shtml etc. index.html (or index.shtml which has SSI capability) are the pages a browser usually goes to when no file is specified e.g. http://yourdomain.com)

Go to your control panel (yourdomain.com/cpanel - login if necessary.)
Click FILE MANAGER under Files Section.
Choose WEB ROOT (public_html/www)
Check box SHOW HIDDEN FILES (dotfiles).
Click GO
Click .htaccess
Click EDIT
Click EDIT
Paste in the following:

ErrorDocument 400 /index.shtml
ErrorDocument 401 /index.shtml
ErrorDocument 403 /index.shtml
ErrorDocument 404 /index.shtml
ErrorDocument 500 /index.shtml

(Change index.shtml with the name of the page(s) you want visitors to go to when getting an error).
Click SAVE CHANGES
Now test it by entering yourdomain.com/blahblah.shtml


Your comments help us keep the knowledge base updated. This is not a medium for support. If you have questions or need help, please contact us via email, phone or live chat for fast assistance.

Post Comment