I have a website with multiple bindings eg
http://www.mysite.com http://mysite.com http://www.mysitenow.com
Using IIS, can I force requests to the second two domains to redirect to http://www.mysite.com
Server Fault is a question and answer site for system and network administrators. It only takes a minute to sign up.Sign up to join this community
You need to have two sites in IIS. The first listens on port 80 and is only bound to:
The second also listens on port 80 but is bound to all of the urls you want redirected, i.e.:
Use the IIS redirect options within IIS to redirect all requests to the first site.
Alternatively, you can also install the Url Rewriter module from Microsoft and create an inbound rewrite rule that does this as well.
In IIS7, select the site you want the 'redirects' to occur for, select 'bindings' on the right hand side, and then just add an entry for each site you want the redirects to start from.
select "mysite.com", select bindings, and then add separate entries with hostnames of "www.mysitenow.com" and "www.mysite.com".
EDIT 1 A hacky way to do that then would be to add them as individual sites, remove any index files from their site directories, and edit the 404 error page to perform a redirect. I've actually used this crappy method to do an SSL redirect.
The details of how you do this through code can be found here https://www.yart.com.au/blog/redirect-to-a-base-url-in-umbraco/