I'm setting up a win 2012 / IIS 8 web server with URL Rewrite module installed to replace an existing web server.
It will have 3 heavily used sites on it mapped to different domain names.
- domain1.com (site 1 in IIS with host name binding to domain1.com)
- domain2.com (site 2 in IIS with host name binding to domain2.com)
- domain3.com (site 3 in IIS with host name binding to domain3.com)
The problem I have is that I have many legacy domains (~20) that need to be redirected (301) variously to these sites and external sites.
1) I can use URL Rewrite rules defined at the server level to create these redirects
or
2) I can create an additional site, and use host name binding to bind all these 20 or so names to that site, and then within that site use - URL Rewrite rules
or
3) what else would be more efficient?
I'm kind of leaning towards option 2 because I would guess the site name bindings would be more efficient than evaluating the URL rewrite rules to all incoming requests - and the URL rewrite rules would only be evaluated when a matching host name came in. Looking at the existing logs traffic to the legacy URLs is < 1%
If you go with 1), all your requests (even to the valid site) have to be processed by the url rewrite module. If you have a whole bunch of rules this adds to the processing time of each request.
If you go with 2), just the requests not already handled by the main site are processed by the rewrite module. This is preferable.
A third option would be, to still have 20+ sites. One for each original site. Then for each site you have a much smaller list of rewrite rules just for that specific site.
Even though this option takes longer to set up (scripting is your friend), it should be the fastest, because you let http.sys in kernel mode decide what do to with the each request, it routes the request to the correct site. Then your rewrite rules have less work to do.