This forum has been moved here:
Helicon Tech Community Forum

ISAPI_Rewrite 3.0 (Forum Locked Forum Locked)
 Helicon Tech : ISAPI_Rewrite 3.0
Subject Topic: non www to www for specific domain
Author
Message |
diggo81
Newbie


Joined: 25 October 2011
Location: United Kingdom
Posts: 2
Posted: 25 October 2011 at 10:57am

Hi, How do i change the following to restrict it to a specific domain name? i need to be able to access the website using the server name internally and the rule seems to add the www to it.

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

Back to Top
 
Guests
Guest


Joined: 01 October 2003
Online Status: Online
Posts: -160
Posted: 26 October 2011 at 6:06am

Hello,

Try using:

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


Regards
Andrew
Back to Top
 
diggo81
Newbie


Joined: 25 October 2011
Location: United Kingdom
Posts: 2
Posted: 26 October 2011 at 7:22am

Hi Andrew,

That worked. thanks very much.

i used it in conjunction with another suggestion to remove eurl.axd, should anyone else have that problem when using .net4 the rewrite rule following the conditions become

RewriteRule ^(.*)(eurl.axd/.*)$ http(?%1s)://www\.%2/$1 [R=301,L]

Cheers,

Andy

Back to Top
 

Sorry, you can NOT post a reply.
This forum has been locked by a forum administrator.

Printable version Printable version