Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

http://example.org.uk/about/

Rewrites to

http://example.org.uk/about/about.html

-----------

http://example.org.uk/blog/events/

Rewrites to

http://example.org.uk/blog/events.html

-----------

http://example.org.uk/blog/2010/11/foo-bar

Rewrites to

http://example.org.uk/blog/2010/11/foo-bar.html

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

share|improve this question
add comment

1 Answer

up vote 0 down vote accepted

Gotchas:

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
add comment

Your Answer

 
discard

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.