Change 404 Error Page in HostGator

In this article, I will show you how you can change the 404 error page in HostGator. Changing 404 error page is very easy task. You just need to make one simple page and you need to set it for the 404 redirect using .htaccess file. Seems hard? Don't worry, we will see it in details.

What is 404 Error?

When you access any webpage, the server sends the response in code. There are many different codes which is used by server to inform the browser about the status of web page requested.

In most of the cases when you get the page in response, you get "200" response code. 200 number is used to inform the browser that the page exists and you will get the data.

If by mistake, you enter the wrong URL in the browser or you clicked on the URL which is not right, you will get "404" response code from the server. 404 is an error code. That means the requested URL doesn't exist. Either the page has been removed or the URL is wrong. In any case, you won't see the expected page, you will be shown the custom 404 page if set.

Why You Need to Set Custom 404 Page?

When a 404 error happens, you will be seen a simple page like following.

404 Error

Since there is no other link on the page, the visitor leaves your website and that creates a bad user experience. If you are in online industry then it is your responsibility to keep visitor engaged on your website.

In HostGator hosted websites, HostGator has already set it's own custom 404 error page. So in your HostGator hosted website, the visitor will see the following 404 error page.

HostGator 404 Error

Even though HostGator has set custom 404 error page for all hosted websites, the visitor leaves your website and reaches to HostGator website. If you want to keep the visitor on your site even after 404 error then you need to set your own custom 404 page.

Create Custom 404 Page

If you want to set your own custom page then first create a custom 404 page. Custom 404 page is a simple html page on your website with your website look and feel and informs the visitors that an 404 error has occurred and the requested page is not there.

When you make a custom 404 page, make sure that the page motivates visitor to visit other pages of your site. I'd like to put sitemap link on custom 404 page. So that visitor visits the sitemap and find the page of her interest. My custom 404 page looks like following.

HGCARJD 404 Error Page

Now save the page with easy to remember name. I give the name notfound.html. Upload the custom 404 page on the server and make sure that the page is running.

Set htaccess Entry

Now you need to make one entry in .htaccess file. Htaccess is a file which is used to set custom configuration for apache web server. Htaccess file is found in the web server root directory with the name .htaccess. If the file doesn't exist under your web site root directory then create the file with the name .htaccess.

You need to put following entry in your .htaccess file.

ErrorDocument 404 /notfound.html

The above entry tells the server that if 404 error happens then show /notfound.html page to the visitor.

That's it. You are set for the custom 404 page. Now visit some random URL on your website and make sure that the notfound.html page is displayed.

HostGator Custom 404 Error Page Video

If you want to see the live explanation of how to set custom 404 page then watch the following video.

I hope now you have understood how to set custom 404 page in HostGator. Try it out!

Back to Hostgator Tutorials

Go to Home