2014-10-30 110 views
0

我有一個網站,如foo.com
我想重定向到http://foo.comhttp://www.foo.com
一個辦法做到這一點是URL重定向,但它不是有效的所有請求。還有其他方法可以做到這一點。URL請求Forwording

+0

你爲什麼說'它不是efficient'?如果它是'301重定向',那麼效率就如同它的效果。只要你做得好,搜索引擎不會在乎你如何重定向。 – SmartDev 2014-10-30 15:59:43

回答

0

您應該here安裝IIS重寫模塊,並在您web.config文件中添加這條規則:

<rewrite> 
    <rules> 
     <rule name="Redirect domain.com to www" patternSyntax="Wildcard" stopProcessing="true"> 
      <match url="*" /> 
      <conditions> 
       <add input="{HTTP_HOST}" pattern="domain.com" /> 
      </conditions> 
      <action type="Redirect" url="http://www.domain.com/{R:0}" /> 
     </rule> 
    </rules> 
</rewrite>