Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm having a hard time converting old .htaccess rewrite rules to new IIS ones so I was wondering if anyone could point me in the right direction. Below are some example URLs I would like rewriting.

Rewrites to


Rewrites to


Rewrites to

The directories and file names are generic and could be anything. Any help would be greatly appreciated.

share|improve this question
up vote 0 down vote accepted


Match URL only matches after the slash that trails the host - (.*) is common, and becomes {R:1} if you want to reuse the capture.

Host/domain name matches are done using {HTTP_HOST} in a condition. Conditions become {C:#}; multiple conditions can be confusing/complicated, I'm not sure how the numbering works precisely there.

Append querystring is usually a good option.

Looks like you want to preserve your host header, and rewrite host in response headers. The former is a applicationHost.config setting, or an appcmd change; the latter is in the GUI, or again can be touched in the .config file by hand, or using appcmd.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.