InMotion Hosting Support Center
In this article we'll discuss why and how to setup the Google custom 404 error page widget on your website. If you happened to have read our previous article on 404 error not found pages, it was discussed how handling 404 requests dynamically can become problematic.
This is because if you continually hit your database dynamically to see if a page exists or not, it can lead to a lot of resource usage from your website, and can result in a slower experience for your site visitors.
You can create a custom 404 error page that is purely HTML code, and then set a 404 error page via .htaccess to help cut down on the resource usage required for fulfilling requests for pages that don't exist.
Typically most websites will have their entire contents crawled by Google, as they index your website to add it to their search engine results. Using the Google custom 404 error page widget in conjunction with a static 404 error page, will allow users to still easily find possibly related content on your website taking advantage of Google's index of your site, instead of relying heavily on your own database.
The first thing you'd want to do is generate your Google custom 404 error page widget code from the following URL:
Customizing your custom Google 404 page widget
  1. From the Select language: drop-down, select your language.
  2. Hightlight the JavaScript code displayed, right-click and select Copy, or hit (Ctrl-C).copy-javascript
  3. Next, you'll want to paste (Ctrl-V) the copied JavaScript code into your custom 404 HTML page in-between the <body> and </body> tags.

    You can review our article on creating a custom 404 error page, if you're unsure of how you would creating or editing this file.

    You also want to make sure that you're replacing the code you copied from Google, for the following:

    var GOOG_FIXURL_SITE = ''

    So that it uses your actual domain name instead of, then just click on Save Changes if you're using the cPanel File Manager.text-editor-save-changes
  4. Now if someone tried to access a page for instance on your domain such as /HowToContactUs that didn't exist, they'll be presented a Google search box for your website with those words already typed in. If Google has indexed a page of yours that mentions how to contact you, chances are the visitor will be able to find this using the Google search, instead of the visitor just being serverd a generic messages asking them to try a different page. google-search

Now that you've successfully setup the Google custom 404 page widget, you might wish to also adjust the style of it to better fit in with the style of your website. You can do this by modifying the CSS code which is exaplained in Google's customizing the 404 widget page.

Was this article helpful?

Related Questions

Here are a few questions related to this article that our customers have asked:
Ooops! It looks like there are no questions about this page.
Would you like to ask a question about this page? If so, click the button below!
Ask a Question

Support Center Login

Our Login page has moved. Please click the button below to be redirected to the login page.

n/a Points
2018-11-07 10:51 am
42,678 Points
2018-11-07 11:27 am
Hello - sorry for the problem with the link. The issue is that Google changed the link, but didn't redirect the old location to the new location. Here's the new location for that article.

n/a Points
2016-04-08 6:49 am

hi, the link to customize Google 404 page widget doesn't exist anymore (no suggestions are given to find related topic); can you give us an update on how this can be achieved today?

10,077 Points
2016-04-08 11:48 am

I do apologize but it looks like Google removed this answer, eve in their post here. So maybe search around for a 404 page generator or if you are using a CMS for a website then there may be a plugin that you can install to handle 404 errors.

Best Regards,
TJ Edens
n/a Points
2015-04-27 5:46 pm

Google page linked is dead.

n/a Points
2014-05-10 11:03 am

You might want to review this. The linked Google page has no dropdown, so it's basically useless.

43,761 Points
2014-05-11 12:03 am
Hello Pat,

The link to the Google page does indeed seem to be missing the dropdown. However, the list of languages and their respective code snippets are there, although they are confusing. Each language has its own snippet so you will need to find it on the page.

It appears to be rather messy so we will investigate with Google to see if the current design is a mistake or intentional before we change the article here.

Thank you so much for pointing the discrepancy out!

Kindest Regards,
Scott M

Post a Comment

Email Address:
Phone Number:

Please note: Your name and comment will be displayed, but we will not show your email address.

7 Questions & Comments

Post a comment

Back to first comment | top

Need more Help?


Ask the Community!

Get help with your questions from our community of like-minded hosting users and InMotion Hosting Staff.

Current Customers

Chat: Click to Chat Now E-mail:
Call: 888-321-HOST (4678) Ticket: Submit a Support Ticket

Not a Customer?

Get web hosting from a company that is here to help. Sign up today!