Web Hosting Talk







View Full Version : ISAPI Rewrite


Ron
06-20-2009, 06:09 AM
I use a program called ISAPI Rewrite to standardize my websites as follows:

If someone goes to http://MyDomain, they are given http://www.MyDomain instead.

The code I am using for this is:

RewriteCond Host: (?!www„.)(.*)
RewriteRule (.*) http„://www.$1$2 [I,RP]

I did not write this code to begin with and am not sure how it works. But can anyone tell me how to get it to do this:

If someone goes to http://www.MySubdomain.MyDomain, they are given http://MySubdomain.MyDomain instead.

I am using a windows 2003 server.

spdfox
06-20-2009, 12:48 PM
try: .......


RewriteEngine on

RewriteCond %{HTTPS} (on)?
RewriteCond %{HTTP:Host} ^(?!www\.)(.+)$ [NC]
RewriteCond %{REQUEST_URI} (.+)
RewriteRule .? http(?%1s)://www.%2%3 [R=301,L]

Ron
06-20-2009, 08:51 PM
It works like it would work if the httpd.ini file were not even there at all. What I am trying to do is redirect to http://MySubdomain.MyDomain if someone types http://www.MySubdomain.MyDomain in their browser.