簡體   English   中英

IIS Express網址重寫模塊非常簡單的重定向不起作用

[英]IIS Express Url Rewrite Module very simple redirect not working

我想在此代碼段中將index.php重定向到home

  <system.webServer>
    <rewrite>
      <rules>
        <rule name="Redirect index.php to home" stopProcessing="true">
          <match url="index.php" ignoreCase="false" />
          <action type="Redirect" url="home" redirectType="Permanent" />
        </rule>
      </rules>
    </rewrite>      
  </system.webServer>

我正在運行IIS Express 8.5。 http://localhost/index.php沒有重定向發生,我得到的是index.php和相同的舊404。試圖刪除瀏覽器緩存沒有幫助。 任何想法?

我無需執行任何操作即可啟用Url-Rewrite-Module,對嗎?

好的,我終於找到了問題。 我的ASP.NET MVC 5項目有兩個Web.config:

  • /Web.config
  • /Views/Web.config

我錯誤地將上面的代碼片段放在/Views/Web.config ,但是它沒有用。 現在,我將其移至/Web.config ,它可以完美運行。

暫無
暫無

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

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