Xpode.com        Click here to Print this article.

Redirect Default or Index (Website starting page) page with www

While doing SEO of site,then a situation arises that the website should be redirected with "www" so that the search engine do not spam website for repeatable contents or make penalty on site.

<script language="javascript" type="text/javascript">
var s="www";
if(document.location.href.search(s) == -1)
window.location="http://www.xpode.com";
</script>


With this code if visitor will visit the site without www then this code will redirect that to url with www. If user has written xpode.com and hit enter. The page will open http://xpode.com, In this situation above code will automatically redirect user to http://www.xpode.com



http://
http://

Contributed by:
Rohit kakria
I am software developer, moderator of xpode.com

Resourse address on xpode.com
http://www.xpode.com/Print.aspx?Articleid=403

Click here to go on website