Motyar

@motyar

Freelance Web Developer

Static Web Hosting, made easy

Feb 2, 2012

Solution: Blogger Redirect to a country-specific URL (ccTLD)

Google changed a lot of things along with their policies. Google started redirecting blogger blogs to country-specific URL. Everyone was wondering and worrying about the bad effect this thing can cause in the future.

Problem solved, you can now redirect all the users to .com

I applies a simple Hack using JavaScript and its done. At least you can let users to share the .com domain. Here it is -


if(-1==(location.host).indexOf(".com")){
    window.location.href = "http://motyar.blogspot.com/ncr"+location.pathname;
}


You just have to put this code in SCRIPT tag in your blog template's HEAD.

Demo

Ok lets take a test drive if it works, Try to open my domain with .in like
http://motyar.blogspot.in/2012/02/simple-solution-of-big-problem-blogger.html

What if you want to redirect to other domains instead of .com?

Here is the code to redirect to .in


if(-1==(location.host).indexOf(".in")){
    window.location.href = "//motyar.blogspot.in/ncr"+location.pathname;
}


What more you can do?

Replace all the interlinks to *.blogspot.com/ncr (You can do this manually or with JS too)
Link your blog to *.blogspot.com/ncr instead of *.blogspot.com in comments, forums and your public / social profiles.

That's all I know, Feel free to say your thought in comments.
Or reply me on twitter, I am @motyar

Labels: ,




By :