Add WWW to the domain name

Dec 21, 2009 at 5:03 PM

Hi,

I would like to have script with the help of Isapi that can add www to beginning to each domain name.

eg.

http://example.com -> http://www.example.com

http://example.com/page/page.aspx -> http://www.example.com/page/page.aspx

thanks

Sudhir

 

Coordinator
Dec 21, 2009 at 5:21 PM

Sudhir, this is in the documentation.  There's an example that does this.  Good luck!

 

Dec 21, 2009 at 5:46 PM


I tried this but that doesn't work.

RewriteCond %{HTTP_HOST} ^(www\.)?example\.com$
RedirectRule ^/(.*)$ http://www.example.com$1 [R=301]

If possible please give me exact correct script.

Thanks,

Sudhir

Coordinator
Dec 21, 2009 at 10:00 PM

There is no other answer, Sudhir.   I suspect IIRF is not installed properly. Check the logfile, Verify that the iirfstatus is ok, etc.  Do other rules work? Before troubleshooting the redirect, Do you have any reason to believe IIRF is installed and operating?

 

Dec 21, 2009 at 10:31 PM

Cheeso,

Other rules works fine e.g.

RewriteRule ^/FolderName/(.*)$ /FolderName/Foldername1/$1 [I,L]
RedirectRule ^/FolderName/FolderName1/PageName.aspx(.*)$    /FolderName/$1   [R=302]

Except this rule that i wrote earlier not working.

http://example.com/page/page.aspx -> http://www.example.com/page/page.aspx
It's work only when you are using only domain name and not after wards any fodler or file name.

I also checked your other post where you are recommening to use this Rule, but that also doesn't work.

RewriteCond  %{HTTP_HOST}  ^domain\.com$
RedirectRule ^/(.*)$       http:/www.domain.com/$1         [R=301]

Thanks,

Sudhir

Coordinator
Dec 22, 2009 at 1:35 AM

Check the logfile - what does it tell you?