Get Rid of Country-Specific URLs in Blogger/Blogspt Blogs

With Google’s decision to redirect all blogspot blogs to country-specific URLs, many bloggers have tried to get out of that situation using different blogger hacks. But, nothing worked out. If you are one of those blogspot users who’d like to get rid of country-specific URLs, here is a simple trick to prevent your blogger/blogspot blog from getting redirected to country-specific URLs.
  1. Go to Blogger Dashboard -> Choose Template -> Edit HTML -> Proceed.
  2. Now copy-paste the following piece of code into your blogger template just below the <head> tag.
    <script type=”text/javascript”>
    var blog = document.location.hostname;
    var slug = document.location.pathname;
    var ctld = blog.substr(blog.lastIndexOf(“.”));
    if (ctld != “.com”) {
    var ncr = “http://” + blog.substr(0, blog.indexOf(“.”));
    ncr += “.blogspot.com/ncr” + slug;
    window.location.replace(ncr);
    }
    </script>
  3. Save template.
And, from now onwards, whenever a visitor lands on your blog, he will not be redirected to the country-specific TLD as the script we’ve used above will force-redirect the visitors to the blogspot.com using the /ncr switch.

No comments:

Post a Comment