This project is read-only.

Host redirector usage and configuration

Web sites often have more than one host name, ie. vs. vs. For many reasons (including SEO and caching) it's recommended to have single main canonical host name and all other domains as aliasses. It's possible to use the URL Rewrite module in IIS, but you can't switch it off for local requests and it may not be available in some scenarios. HostRedirector comes here to the rescue

Register configuration section

Include the following section registration in your web.config file:
    <sectionGroup name="altairis.web">
        <section name="management" type="Altairis.Web.Management.Configuration.ManagementSection, Altairis.Web.Management"/>

Register HTTP module

Register the RedirectorModule HTTP module (used also by SSL redirector, so register it only once):
        <add name="RedirectorModule" type="Altairis.Web.Management.RedirectorModule, Altairis.Web.Management" />

Configure the host redirector

This is minimal configuration to get the host redirector up and running - enable it and specify canonical host name:
        <hostRedirector enabled="true" hostName="" />
Possible attributes of the hostRedirector element:
Name Default value Description
enabled false Set to true to enable host redirector.
hostName mandatory The canonical (target) host name.
excludeLocalRequests true Ignore requests coming from the same computer (useful for development).
verbs GET Comma-separated list of HTTP verbs for which redirection should be used.
permanent false When set to true, the 301 Moved Permanently status is used for redirect.

Last edited Jul 4, 2011 at 8:52 PM by altair, version 2


No comments yet.