Click here to hide categories Click here to show left categories

User: Home          welcome : Guest          Log In / Register here     




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

Share this article   |    Print    |    Article read by 3381 times
Author:
Rohit kakria
I am software developer, moderator of xpode.com
Related Articles: No related article
Related Interview Questions: No related interview question