Tuesday, March 6, 2012

Redirect Back Blogger Blogs from .in and .com.au to .com Domain

If you access any of the Blogger hosted blogs from India, Australia or from a host of other countries, Google will automatically redirect you to the corresponding country specific domain.

For instance, if a blog’s address is xyz.blogspot.com and you try opening that page from an IP address in India, you will be automatically redirected to xyz.blogspot.in. A similar redirection will occur for individual article pages as well.

How to Prevent Blogger Blogs from Redirecting to Country Specific Domain : 


I have come up with a javascript code that will always serve the .com address to your visitors irrespective of their geographic location

Here’s how you do it.

1. Go to Template > Edit HTML (For old interface : Go to Design > Edit HTML)

2. Search for <head>

3. Paste the following code just below the the <head> tag :

<script>
if ((window.location.href.toString().indexOf('.com/'))=='-1')
{
window.location.href = window.location.href.toString().replace('.blogspot.in/','.blogspot.com/ncr/').replace('.blogspot.com.au/','.blogspot.com/ncr/').replace('.blogspot.co.uk/','.blogspot.com/ncr/').replace('.blogspot.jp/','.blogspot.com/ncr/').replace('.blogspot.co.nz/','.blogspot.com/ncr/').replace('.blogspot.ca/','.blogspot.com/ncr/').replace('.blogspot.de/','.blogspot.com/ncr/').replace('.blogspot.it/','.blogspot.com/ncr/').replace('.blogspot.fr/','.blogspot.com/ncr/').replace('.blogspot.se/','.blogspot.com/ncr/').replace('.blogspot.com.es/','.blogspot.com/ncr/').replace('.blogspot.pt/','.blogspot.com/ncr/').replace('.blogspot.com.br/','.blogspot.com/ncr/').replace('.blogspot.com.ar/','.blogspot.com/ncr/').replace('.blogspot.mx/','.blogspot.com/ncr/');
}
</script>

4. Save your template.

Thats it! Now your blog is  free from country specific redirection :)


3 comments:

  1. Not sure if this is a good idea considering Google' take on localization of Blogger's blogs.
    But nice js code you figured out there!!

    ReplyDelete

Your feedback is always appreciated. We will try to reply to your queries as soon as time allows.