簡體   English   中英

從asp.net網站創建301重定向到另一個

[英]Creating 301 redirects from asp.net website to another

我有一個網站打算關閉,並用另一個具有不同域的網站替換,我該如何設置從舊網站上的特定頁面到我新網站上的相關頁面的301重定向?

我看過IIS網址重寫模塊,但無法弄清楚。 請幫助?

我已經試過了

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

但是導航到主頁時沒有任何反應

您可以使用以下路由規則更新web.config:

<system.webServer>
  <rewrite>
    <rules>
      <rule name="Redirects to new domain" stopProcessing="true">
        <match url=".*" />
        <conditions logicalGrouping="MatchAny">
          <add input="{HTTP_HOST}" pattern="olddomain.net" />
        </conditions>
        <action type="Redirect" url="http://www.newdomain.com/{R:0}" />
      </rule>
    </rules>
  </rewrite>
</system.webServer>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM