Page 1 of 1

redirect pages to www using javascript

Posted: Mon Nov 29, 2010 4:01 am
by shaam
Hi,
I want to redirect pages e,g 'http://mydomain.com/pagename.html' to 'http://www.mydomain.com/pagename.html",i.e if anyone access without www then it will be added automatically,how can i do this using javascript?
plz help
Thanks

Re: redirect pages to www using javascript

Posted: Thu Dec 02, 2010 7:17 pm
by spedula
Why would you need to do this? most browsers auto fill in www.

Either case, it would be easier to set up your .htaccess file to do this. That way you don't have to post this code on every page on your site.