I've been looking and trying out different pieces of code for months to no avail. Most of what I have found is for .htaccess, and not for IIS.

I have two scenarios:

  1. subdomain1.domain.com to subdomain2.domain.com keeping everything appended intact. For example .com/ehd/tickets/71921/edit <- this must remain the same.

  2. The other scenario is: domain.com/subfolder to subdomain.domain.com again keeping everything appended.

Is this even possible? I've tried everything I can think of with the resources I've found. Creating a CNAME doesn't change the URL in the address line. I would welcome any help I could get!

  • 1
    Both are possible; most rewrites that can be done with Apache can likewise be done with IIS, with either a web.config file or using a rule template with the Microsoft URL Rewrite Module. There are two good resources from Microsoft for these in my answer here. – dan Feb 10 '16 at 5:03

You need to install url_rewrite plugin for IIS. It is available on IIS7 and up though it will tell you that it only works on IIS7.

You will then write the redirect commands in web.config and it is very tricky due to the difference of how url_rewrite handles rewriting.

The best option I can suggest is to try it out on a local IIS installation with URL_rewrite installed, there is a URL_rewrite builder embedded inside IIS.

Be careful since IIS also have an outbound rewriting, this will change your outgoing url links.

For more info, check this website http://www.iis.net/learn/extensions/url-rewrite-module/creating-rewrite-rules-for-the-url-rewrite-module

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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