HackingUniversity - Hacks . Tricks . How-To's

12 April 2016

Prevent Blogger from Redirecting to Country Specific URL

Google has implemented the country specific redirection for blogger blogs, so if you are situated in India and you open any Blogger blog still using the .blogspot.com subdomain then you will example.blogspot.in instead of example.blogspot.com and any other person from other country will see that blog in his own country specific URL like a person from UK with see example.blogspot.uk instead of example.blogspot.com

Prevent Blogger from Redirecting to Country Specific URL

So in this post we will see how you can stop blogger blogs from redirecting to country specific URL’s with a simple script.

How to Stop Blogger from Redirecting your Blogger Blog to a Country Specific URL

So if you just want to serve your blogger blog from one single URL that is example.blogspot.com then this small script could help you out.

Remember If you are using Custom Domain like www.example.com then this script should not be applied on your blog. You can check how to migrate your blogger blog subdomain to a custom domain.

  1. Open Blogger > Template > Edit HTML.
  2. Press Ctrl + F and search for <head> tag and paste below script right below this tag.

    <script type="text/javascript">var blog=document.location.href.toLowerCase();if(!blog.match(/\.blogspot\.com/)){blog=blog.replace(/\.blogspot\..*?\//,".blogspot.com/ncr/");window.location.replace(blog)};</script>

  3. Now press Save Template and refresh your blog, you will see how your blog redirects to example.blogspot.com instead of your country specific URL.

Now any person viewing your blog from any country would see your posts under example.blogspot.com instead of his country specific URL’s. This helps you to serve one single URL all across your blog.