How to disable country specific redirection of Blogger Blogspot sites?

3 min read
How to disable Blogger Blogspot site from redirecting to country specific domain How to disable country specific redirection of Blogger Blogspot sites?
If you are using Blogger Blogspot, you might have noticed that Google redirects Blogger Blogspot sites to country specific URLs. For example, if I open this blog whose URL is techubber.blogspot.com, it gets redirected to techubber.blogspot.in, since I am from India. Similarly, a visitor from UK would see techubber.blogspot.co.uk and so on. You can find the reason from this update here why Google chose to implement country specific domain. In a nutshell, Google implemented country specific domains so that is a site need to be blocked in a certain country but made available on others. 

But for bloggers, it creates issues especially with social stats like Tweet counts, Google+, Facebook Likes and even Facebook comments. Therefore, many users prefer to disable the domain redirection. In this post we will see how to implement Blogger from redirecting to country specific domains.
With the country specific domain redirection in place, if we like to see content on other domains we could by slightly modifying the URL like this:

    http://[blogname].blogspot.com/ncr for an entire blog
    http://[blogname].blogspot.com/ncr/examplepage for a single post.
 

Please note that the country domain redirection only applies if you are using Blogger without custom domain. If you are using custom domain, then the domain of your blogger blog will always be the domain you purchased and setup with Blogger. [See here how to setup custom domain for Blogger]


How to disable country specific redirection of Blogger Blogspot sites?
To disable Blogger from redirecting to country specific URLs, the following code (source: Labnol.org) is applied to the Blogger HTML template in the <head> section. You can place it right after the opening head tag <head>.

  • Go to Blogger dashboard
  • Theme> Edit HTML
  • Find <head>
  • Copy the following JavaScript code and paste it right after <head>
<script type='text/javascript'>
     var blog = document.location.href.toLowerCase();
   if (!blog.match(/\.blogspot\.com/)) {
       blog = blog.replace(/\.blogspot\..*?\//, &quot;.blogspot.com/ncr/&quot;);
      window.location.replace(blog);
  }
  </script>


Alternative code for the same: apply any one
 
<script type="text/javascript">
var blog = document.location.hostname.split(".");
if (blog[blog.length - 1] != "com") {
var ncr = "http://" + blog[0] + ".blogspot.com/ncr";
window.location.replace(ncr + document.location.pathname);
}
</script>

After applying the code, if you access your Blogger blog with .COM in the URL, it will stay without redirecting to .COUNTRY specific domain.

This solution has been a big relief at least in my case for Facebook Comments. Without this solution applied, a user commenting on this blog on his country specific domain (eg. techubber.blogspot.au) was not visible to me with techubber.blogspot.in and vice-versa. But after the solution applied, the blog URL will always stay at .COM for all users. So all the comments are visible.

How to resolve - Missing Facebook comments on Blogger sites due to country specific redirection
https://about-tutor.blogspot.com//search?q=how-to-setup-custom-domain-for-blogger-blog-site


After applying the code to stop country specific redirection, I see country specific domains still appended to .COM in Google Adsense's Sites traffic report.

How to disable Blogger Blogspot site from redirecting to country specific domain How to disable country specific redirection of Blogger Blogspot sites?


 But I have to checked a solution for this.
If you found a solution, do let me know in the comments please.


 
Post a Comment