How to disable country specific redirection of Blogger Blogspot sites?

How to disable Blogger Blogspot site from redirecting to country specific domain?
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
http://techubber.blogspot.com/2017/07/how-to-resolve-missing-facebook-comments-blogger-country-domain-redirect.html


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.

google adsense report sites


 But I have to checked a solution for this.
If you found a solution, do let me know in the comments please.
 
UPDATE:
 
Google discontinued Country Specific Domain redirection in May 2018. Blogger stopped redirecting to ccTLD and country-specific URL would now redirect to blogspot.com address (or custom domain if you have one).
 
Improved Localization and Blogspot ccTLDS: Your location determines your country services. Historically, these services have been labeled and accessed via country code top level domain names (ccTLD), such as blogspot.com.au for Australia. We’re updating the way we label country services on Blogger - now the choice of country service will no longer be indicated by domain. Instead, blogspot.com will serve you the country service that corresponds to your location, and all existing blogspot ccTLD domains will redirect to blogspot.com. This will help simplify URLs for international audiences.

Comment with Facebook

3 comments:

  1. This is very nice never had the idea but I'd work on it like the tutorial said

    ReplyDelete
  2. Hi friend, this code din't work for me, but helped me create a new code that works, check it: https://www.saibatudomt.com.br/2018/04/solved-learn-how-to-prevent-your-blogspot-blog-from-redirecting-to-country-domains.html

    ReplyDelete