使用RewriteRules.config将非www重定向到www

时间:2012-11-13 09:19:29

标签: windows-server-2008 umbraco

希望将example.com重定向到www.example.com,将example.de重定向到www.example.de

<rule name="CanonicalHostNameRuleCOM" stopProcessing="true">
      <match url="(.*)" />
      <conditions>
        <add input="{HTTP_HOST}" negate="false" pattern="^example\.com$" />
      </conditions>
          <action type="Redirect" url="http://www.example.com/{R:1}" redirectType="Permanent" />
        </rule> 
<rule name="CanonicalHostNameRuleDE" stopProcessing="true">
      <match url="(.*)" />
      <conditions>
        <add input="{HTTP_HOST}" negate="false" pattern="^example\.de$" />
      </conditions>
          <action type="Redirect" url="http://www.example.de/{R:1}" redirectType="Permanent" />
        </rule>

1 个答案:

答案 0 :(得分:0)

尝试关注.COM&amp; .DE

<强> .COM

<rule name="Redirect to WWW COM" stopProcessing="true"> 
  <match url=".*" /> 
  <conditions> 
    <add input="{HTTP_HOST}" pattern="^example.com$" /> 
  </conditions> 
  <action type="Redirect" url="http://www.example.com/{R:0}" redirectType="Permanent" /> 
</rule>

<强>由Matchi.com提供回到

<rule name="Redirect to WWW DE" stopProcessing="true"> 
  <match url=".*" /> 
  <conditions> 
    <add input="{HTTP_HOST}" pattern="^example.de$" /> 
  </conditions> 
  <action type="Redirect" url="http://www.example.de/{R:0}" redirectType="Permanent" /> 
</rule>

我希望这会有所帮助

相关问题