Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Ove Andersen 435 posts 1541 karma points c-trib
    Jul 13, 2009 @ 14:36
    Ove Andersen
    1

    URL rewrite/redirect in IIS7

    I realize that this is not entirely umbraco-related, but I have the impression that there is a lot of experts on url rewriting on this forum.

    How can I make a permanent redirect of http://3ddesign.no to http://www.3ddesign.no ?

    I also have subdomains like http://vestkran.3ddesign.no that can not be affected by this rule.

    Is there a way to do this without hard-coding every subdomain into the rule?

    My initial thoughts were to check for urls with only two dots and then prefix it with www, but it doesn't work.

  • Chris Dunn 75 posts 127 karma points
    Jul 13, 2009 @ 16:18
    Chris Dunn
    0

    Can you just add multiple host header entries in IIS for the same site?  one for 3ddesign.no and one for www.3ddesign.no?  So for 3ddesign.no you wouldnt need to redirect, it would just be handled by the same site.  Then use a wildcard host header *.3ddesign.no for all others.  Not positive but IIS may check for an exact host header entry before checking wildcard.  Again, not sure but worth a shot.

  • stewart.whiting 15 posts 44 karma points
    Jul 13, 2009 @ 16:21
    stewart.whiting
    1

    At the moment you might have an A record of 'www' and an A record of 'vestkran'. Where these two records point depend on your hosting setup. There are two methods:

    1) A separate IP for each record. This in effect means you have a single site on each IP address. When you create the site in IIS (or Apache), you bind it to the IP address that is used in the A record. Port 80 on that IP being the public http:// site and port 443 being the SSL https:// site.

    2) As there are limited IP addresses (and they're rapidly running out), most hosts use 'host headers' to allow multiple sites to be served for a single IP. In this case, each site in IIS is bound to the same IP address on the DNS A record, but, on the host headers that identify the site must be set within IIS. Therefore, when a request comes in on the shared IP address, IIS would inspect the request and decide which site/domain/subdomain it is for, and then use that site accordingly.

    Depending on which method you are using, off the top of my head there are a few options on how you want to acheive a redirect:

    ... 1) With a wildcard DNS record (*.3ddesign.no), all requests will go through to the site - a script could then handle the redirect IF 'www.' is not present. The wildcard A record wouldn't be used if there were other explicit A records in the DNS zone (ie, vestkran). You could handle the subdomains with host-headered 'virtual' sites on that same IP, or delegate them out to other servers.

    ... 2) With a shared IP (ie, shared hosting), you would have to create a site that has the host header '3ddesign.no' and have a separate site with the host header 'www.3ddesign.com' (that actually has the site). You could then have a Response.Redirect script on the '3ddesign.no' site. This wouldn't affect your other subdomains.

    Possibilities depend on your setup - and if you're on shared hosting where you have no control of the server, how much control you have of the DNS and site settings.

  • stewart.whiting 15 posts 44 karma points
    Jul 13, 2009 @ 16:26
    stewart.whiting
    0

    Chris - as far as I know, wildcard host headers aren't supported in IIS6 (not sure about IIS7)

  • stewart.whiting 15 posts 44 karma points
    Jul 13, 2009 @ 16:28
    stewart.whiting
    0

    as its not in the HTTP spec, neither does II7 (http://dirk.net/2008/05/28/wildcard-host-header-binding-and-subdomains-with-iis7/)

  • Chris Dunn 75 posts 127 karma points
    Jul 13, 2009 @ 16:38
    Chris Dunn
    0

    Yep...found the same thing. Fair amount of complaints about it on the forums, but looks like microsoft has still chosen to leave it out. Looks like DNS configuration is the only option with a combo of urlrewriting.  Maybe IIS 8,9, or 10 they'll have a better solution...maybe.

  • Ove Andersen 435 posts 1541 karma points c-trib
    Jul 15, 2009 @ 09:02
    Ove Andersen
    0

    vestkran, 3ddesign and most of the subdomains are sites located in the same umbraco installation.

    The reason I would like to have a redirect from 3ddesign.no to www.3ddesign.no is because of SEO optimalization. Two url's with the same content is not an optimal solution SEO-wise.

    Just another thought. I could strip the www. from all url's. That way, all the subdomains should be left alone.
    That said, solution number 2 postet by Stewart, might also be a solution that would work for me.

Please Sign in or register to post replies

Write your reply to:

Draft