Saturday 10 January 2015

Disable 302 Redirection to Country Specific Domains

Disable 302 Redirection to Country-Specific Domains

                         If you are viewing a blog with address example.blogspot.com from France (FR), then you'll be redirected to .fr domain - example.blogspot.fr. Similarly, if you are viewing from the United Kingdom it will be redirected to example.blogspot.co.uk! It is happening so that Google can easily block the content which is not appropriate for a specific country according to the law of that country and can easily serve that same content in another country without any issues.

However, this redirection is "302 Redirect" which is a temporary change and not a 301 redirect which is a permanent change of address.

This country-based URL redirection does mean some negative consequences to your blog! 

With that redirection, your Alexa Traffic Rank will be separated into different domains. So, for better search engine optimization (SEO), you can add the following piece of code to your template and it will always serve the .com address to your visitors.

Go to Design -> Edit HTML. Click on "Expand widget templates" and search for "</head>".
Now copy and paste the following code BEFORE 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>

Save your template and you are ready!

Read more : https://website-designing-company-rishikesh.blogspot.com/2019/12/web-designing-and-development-company.html

No comments:

Post a Comment