[英]How can i configure in web.config a 301 permanent redirect?
我很樂意使用web.config來執行從舊域到另一個域的301重定向。 我怎么能這樣做?
在你的答案中,請記住IIS是v7和
我不想使用任何第三方DLL像urlrewriteing.net等或使用ASP.NET代碼或配置IIS,為此。
我相信這可以做到,但是怎么做?
更新:我嘗試了Parvesh的答案,但我感覺不是“正式”支持或者我正在制造其他非常錯誤的東西。
您需要在IIS下安裝URL重寫模塊,然后您可以在web.config中使用它。
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Redirect to WWW" stopProcessing="true">
<match url=".*" />
<conditions>
<add input="{HTTP_HOST}" pattern="^domain.com$" />
</conditions>
<action type="Redirect" url="http://www.domain.com/{R:0}"
redirectType="Permanent" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.