How to redirect a URL path in IIS?

codeulike picture codeulike · May 20, 2009 · Viewed 238.2k times · Source

In IIS 6.0, is there an easy way to re-direct requests to a folder to another folder, while preserving the rest of the path.

e.g.

If I have moved the content from:
mysite.org.uk/stuff
to
stuff.mysite.org.uk/

Can I automatically redirect requests for specific pages like
mysite.org.uk/stuff/countrybriefing/tanzania/travel.html
to
stuff.mysite.org.uk/countrybriefing/tanzania/travel.html

I know that .htaccess can do things like this in Apache, is there an equivalent in IIS?

Answer

Nirmal picture Nirmal · Sep 20, 2009

Format the redirect URL in the following way:

stuff.mysite.org.uk$S$Q

The $S will say that any path must be applied to the new URL. $Q says that any parameter variables must be passed to the new URL.

In IIS 7.0, you must enable the option Redirect to exact destination. I believe there must be an option like this in IIS 6.0 too.