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 :)


7 comments:

  1. nicely done. +1 following.

    ReplyDelete
  2. 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
    Replies
    1. Totally agreed with your point. However, I feel that the blog owners should be given a choice to have localization or not.

      Delete
  3. Hi....
    Go to Blogger and log into your website. When you're viewing the main dashboard, click on 'Theme' in the left hand menu. You'll see a preview of your theme with the option to 'Edit HTML' under the 'Live on Blog' window. Obviously you'll replace yournewwebsite.com with your new url!
    You are also read more Instant Loan

    ReplyDelete

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