Link to home
Start Free TrialLog in
Avatar of Brian Sandt
Brian Sandt

asked on

IIS URL Rewrite Rules question

Currently in IIS, I have 3 URL Rewrite rules:
1.  Redirect http to https
2.  If they forget to put in the www in front of the domain name they are redirected to the correct site
(This is what I used:  doesn't match pattern  ^www\.([.a-zA-Z0-9]+)$)
3.  If they come in using www1 (which still exists), they are redirected to another URL

Now, they want to start using subdomains (example:  clientname.domain.com)
What currently happens is rule #2 puts a www in front of the name because it doesn't have www.  
We have a lot of clients and they want a subdomain for each one.

Any ideas on how to accomplish this?
Avatar of Kevin Cross
Kevin Cross
Flag of United States of America image

You could write the rule to ensure their are three parts.
i.e., start with ^([a-zA-Z0-9]+)\.([a-zA-Z0-9]+)$ to do your redirect to www
then do the remaining rules after
ASKER CERTIFIED SOLUTION
Avatar of Kevin Cross
Kevin Cross
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial