Redirects 404 Page To Specific Page

Redirects 404 Page To Specific Page

The 404 error page should be resolved immediately so that it doesn't have a negative impact on the development of a website or blog.

Apart from being bad at search engines like Google, Bing, Yandex, etc., error pages are also not liked by visitors because they seem to deceive them with an empty page with no content.

Causes of the 404 error

The appearance of the 404 not found error page can occur due to intentional or unintentional errors, it can be due to your own mistakes or it can also be because of what other people have done.

I hope you guys have understood about this. Therefore, as blog managers, we must always monitor the health of our blog.

The following are common causes of the 404 error, including:

  1. Entering the wrong URL : The cause of the first error is quite simple, namely an error in typing or writing the URL.
  2. Caching error : The 404 caching error problem can also cause this error to appear, if the browser you are using cannot find the website cache file.
  3. Problematic DNS settings : Another factor that can cause the 404 to appear is a problem with your domain that has not propagated to the Domain Name System (DNS) you are using.

How to redirect 404 page automatically

In this way, every visitor who accesses the 404 page will be automatically redirected to a certain page using Javascript. To do so, please follow the steps below.

Enter Blogger dashboard > select Theme > select Edit HTML

Paste the following code above the tag  </body> or &lt;/body&gt;

<!--[ Redirect error 404 ]-->
    <b:if cond='data:view.isError'>
        <script>//<![CDATA[
      KYM_redirect=setTimeout(function() {
      location.pathname= '/';}, 2000);
        //]]></script>
    </b:if>

Take note! In the marked section.

  • / is a shortened url to the Homepage. You can change it to a specific url.
  • 2000 is the time lag before the page redirects. You can change as you wish.

3. If you have! Save and see the results.

That's a short way how to redirect the 404 page to a specific page.

Post a Comment