2012-11-13 86 views
0

想example.com重定向到www.example.com和example.de到www.example.de中重定向非www到www與RewriteRules.config

<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> 

回答

0

嘗試以下的.COM &。 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> 

我希望這會有所幫助