Here's How:
This country based URL redirection is likely to impact your Blogger blogs in a not so positive manner. For example:- The social stats – like your Facebook Likes, Google +1s and Tweet counts – for your blog posts may be reduced as the URLs for the same blog post will be different for different visitors.
- You will have a similar problem if you are using an external commenting platform like Disqus or Facebook Comments because the blog URLs will be different even when the underlying page is the same.
- Also, if canonicalization isn’t implemented properly, it may cost you some Google juice as external websites may link to your country-specific pages.
- Some users have reported a dip in Google AdSense earnings when pages are served through 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.
Click the Save Template button and now your Blogger Blog will always serve with the blogspot.com URL.
- <script type="text/javascript">
- // Written by Amit Agarwal
- /* Get the full URL of the current blogger page */
- var blog = document.location.href.toLowerCase();
- /* Do not redirect if the domain is .com already */
- if (!blog.match(/\.blogspot\.com/)) {
- /* Replace the country TLD with .com and ncr switch */
- blog = blog.replace(/\.blogspot\..*?\//, ".blogspot.com/ncr/");
- /* Redirect to the new .com URL in the current tab */
- window.location.replace(blog);
- }
- // Source: http://labnol.org/?p=21031
- </script>
The JavaScript snippet gets the URL of the current Blogger page and if it isn’t served from the .com domain, the code replaces the country specific TLD (like blogspot.co.au or blogspot.pk) with the blogspot.com URL. It also adds the /ncr switch to force-redirect the visitor to the blogspot.com address.

0 comments:
Post a Comment