Link to home
Create AccountLog in
Avatar of lwork
lwork

asked on

How to use IIS7.5 to rewrite only selected urls

We've just migrated to a Windows 2008 IIS7.5 server from IIS 6.0 and need to confirm how to set up url rewrites through IIS.

We want any subdomain that isn't "mail." or "secure." or that comes in as an IP address to be rewritten to www.oursites.com.
site IP associated with that subdomain but anything that came in as:

http://oursites.com/anything
or
http://55.55.55.55/anything

would all be rewritten as
www.oursites.com/anything

TIA
Avatar of sykesjs
sykesjs
Flag of United States of America image

The easiest way to do this would be to create a virtual site in IIS that has host headers for all of your URLs that you want rewritten.  Then simply redirect all requests to the site preserving the path and query string.

Assuming you have installed HTTP Redirect, you would then do a redirect on the virtual site with the host headers that need to be rewritten to something like:

http://www.oursites.com$V$Q

For more information check out http://oneidia.blogspot.com/2010/09/simple-http-redirect-with-querystring.html
Avatar of lwork
lwork

ASKER

I want everything but mail.mysite.com/(all paths) and secure.mysite.com/(all paths) to go to www.mysite.com/(all paths), is that applicable for that?
ASKER CERTIFIED SOLUTION
Avatar of sykesjs
sykesjs
Flag of United States of America image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Avatar of lwork

ASKER

I've requested that this question be deleted for the following reason:

didn't get a useful answer
SOLUTION
Avatar of Steve Bink
Steve Bink
Flag of United States of America image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
To be clear, sykesjs' solution would work for the issue as you have described it.  I happen to think this is better addressed with the rewriting module, but six of one, half-dozen of the other.