redirect pages to www using javascript

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
shaam
Forum Newbie
Posts: 20
Joined: Tue Jun 23, 2009 6:36 am

redirect pages to www using javascript

Post 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
User avatar
spedula
Forum Commoner
Posts: 81
Joined: Mon Mar 29, 2010 5:24 pm

Re: redirect pages to www using javascript

Post 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.
Post Reply