Thursday, June 25, 2015

Blogger Redirection Code to redirect your site to .com domain

Blogger Redirection Code to redirect your site to .com domain.



Argentina [blogspot.com.ar]
Australia [blogspot.com.au]
Brazil [blogspot.com.br]
Canada [blogspot.ca]
Czech Republic [blogspot.cz]
France [blogspot.fr]
Germany [blogspot.de]
Hong Kong [blogspot.hk]
India [blogspot.in]
Italy [blogspot.it]
Japan [blogspot.jp]
Mexico [blogspot.mx]
New Zealand [blogspot.co.nz]
Portugal [blogspot.pt]
Romania [blogspot.ro]
Spain [blogspot.com.es]
Sweden [blogspot.se]
UK [blogspot.co.uk]

The blogger redirect code where you can redirect your local site to international .com domain for example example.blogspot.com will redirect to.com.au in australia and so on , this is the big problem for sites with good page rank and alexa  rank. Now here is the best code for the blogger.

Code #1

<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>

Best code..

Code #2

<script type='text/javascript'> var str= window.location.href.toString(); if ((str.indexOf('.com/'))=='-1') { var str1=str.substring(str.lastIndexOf(".blogspot.")); if (str1.indexOf('/')=='-1') { var str2=str1; } else { var str2=str1.substring(0,str1.indexOf('/')+1); } window.location.href =window.location.href.toString().replace(str2,'.blogspot.com/ncr/'); } </script>