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: www non-www
Author
Message |
novologic
Newbie


Joined: 10 January 2012
Posts: 3
Posted: 10 January 2012 at 3:53pm

Thank you in advance for your help.

I am using the following to redirect non-www url to a www
url.

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

However, I have 2 websites being served up by IIS7...

domain-1.com
sl1.domain-2.com

domain-1.com redirects to www.domain-1.com - "very nice"
sl1.domain-2.com redirects to www.sl1.domain-2.com - "not
good!"

note: these 2 domains share the same physical path.

How can i adjust my config so that domain-1.com redirects
to www. and sl1.domain-2.com does not re-direct ?

-steve




Edited by novologic - 10 January 2012 at 4:10pm
Back to Top
 
Guests
Guest


Joined: 01 October 2003
Online Status: Online
Posts: -160
Posted: 11 January 2012 at 8:27am

Hello Steve,

Do you mind to hardcode the sl1.domain-2.com?

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



Regards
Andrew
Back to Top
 
novologic
Newbie


Joined: 10 January 2012
Posts: 3
Posted: 11 January 2012 at 9:54am

Andrew,

Thanks for your advice, unfortunately I could not get the
code you supplied to work for me.

It may be easier to configure (and for me to understand)
if the requirement was simplified to:

Only prepend the subdomain "www" if the domain is
equal to http://signupanytime.com


I appreciate your time. What do you think?
-steve

Edited by novologic - 11 January 2012 at 9:55am
Back to Top
 
novologic
Newbie


Joined: 10 January 2012
Posts: 3
Posted: 11 January 2012 at 8:19pm

It appears this did the trick:


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

Only http://signupanytime.com will redirect to
http://www.signupanytime.com
Back to Top
 

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

Printable version Printable version