This project is read-only.

Host redirector usage and configuration

Web sites often have more than one host name, ie. your-company.com vs. www.your-company.com vs. www.yourcompany.com. 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:
<configSections>
    <sectionGroup name="altairis.web">
        <section name="management" type="Altairis.Web.Management.Configuration.ManagementSection, Altairis.Web.Management"/>
    </sectionGroup>
</configSections>

Register HTTP module

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

Configure the host redirector

This is minimal configuration to get the host redirector up and running - enable it and specify canonical host name:
<altairis.web>
    <management>
        <hostRedirector enabled="true" hostName="www.yourcompany.com" />
    </management>
</altairis.web>
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

Comments

No comments yet.