301 Redirect one domain to another using web.config

后端 未结 1 1732
北荒
北荒 2020-12-15 05:01

I have multiple domains pointing to one hosting location. I wish to establish one of the domains as my main domain and therefore I wish to perform a 301 redirect to this mai

相关标签:
1条回答
  • 2020-12-15 05:26

    This is not really that umbraco related but I think what you want to do is this:

    <rewrite>
      <rules>
        <rule name="redirect" enabled="true">
          <match url="(.*)" />
            <conditions>
              <add input="{HTTP_HOST}" negate="true" pattern="^www\.example\.com$" />
            </conditions>
          <action type="Redirect" url="http://www.example.com/{R:1}" appendQueryString="true" redirectType="Permanent" />
        </rule>
      </rules>
    </rewrite>
    

    Match all urls unless the host name part is exactly www.example.com - and redirect those to www.example.com/whatever.

    0 讨论(0)
提交回复
热议问题