Iis – Using URL rewrite module for http to https redirect

iisiis-7sharepointweb-server

Following ruslany's suggestion on the URL Rewrite Tips page here, I'm trying to use URL Rewrite to redirect http:// requests for my site to https://. I've written and tested the rule using a test site I set up, and so now the final piece is to create a second site (http) to redirect to my https site. (I need to use a second site because I don't want to uncheck the "Require SSL encryption" checkbox on my existing site.)

I'm an IIS newbie so my question is: how do I do this? Should I create a site with the same name and host header, only it will be bound to http? Will IIS let me create a site with the same name? I don't want to screw anything up with my existing site (which is a SharePoint site, currently used by external users). That site currently has http and https bound to it. So my assumption is that, using ISS (not SharePoint), I will create a new site (http only) with the same name and host header as my existing site, and add the URL Rewrite rule to the http site. And then I guess I should remove the http binding from my existing site? Does that seem correct?

Any advice, gotchas, etc., would be appreciated. Thanks.

Best Answer

You're on the right track. Usually in these cases I will create an HTTP version with the bindings on port 80 and the appropriate IP/hostname combinations, then set the host to use HTTP redirection to the secure URL with a 301 status code. Then, there would be a second entry in IIS which would hold the bindings for the SSL version. The names on the list in IIS don't matter much, but I would make them unique so they are easy to differentiate. Also remember to give each site its own "home" folder where the web.config file will be stored. If they share a home folder the settings will not come out right (in IIS 7 anyway, IIS 6 does not have this issue).