2

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

1
  • Would this be better done with DNS? Apr 13 '11 at 4:21
3

You need to have two sites in IIS. The first listens on port 80 and is only bound to:

http://www.mysite.com

The second also listens on port 80 but is bound to all of the urls you want redirected, i.e.:

http://mysite.com
http://www.mysitenow.com

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.

1
  • Sounds good but I am going to do this via code, as a developer, its easier for me!
    – Petras
    Apr 14 '11 at 1:21
1

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.

For example:

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.

1
  • Adding a binding does not cause a redirect. See my comment below.
    – Petras
    Apr 13 '11 at 5:25
1

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/

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.