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
Microsoft IIS Web Server

Avatar of undefined
Last Comment
Steve Bink

8/22/2022 - Mon
sykesjs

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
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
sykesjs

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
lwork

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

didn't get a useful answer
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck
SOLUTION
Log in to continue reading
Log In
Sign up - Free for 7 days
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
Steve Bink

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.