How to Prevent your Blogger blog from redirecting the country-specific URL.
Google, as most would know, redirects Blogger blogs to country-specific domains. For instance, if you open onedirection.blogspot.com in your browser, you might be redirected to onedirection.blogspot.in if you are located in India or to onedirection.blogspot.com.au if you access the same blog from Australia.
Prevent Blogger from Redirecting to Country-Specific Domains
Go to your blog inside the Blogger Dashboard and choose Template. Then click the �Edit HTML� button followed by �Proceed.� Next, copy-paste the following code into the template after the <head> tag. thanks to labnol for this code
<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>
Click the Save Template button and now your Blogger Blog will always serve with the blogspot.com URL.
This simple script parses the domain name (document.location.hostname) of your blog page and if it includes a country-specific URL (like blogspot.in), it will force-redirect the visitor to the blogspot.com address using the /ncr switch.
0 comments:
Post a Comment