gpt4 book ai didi

asp.net-mvc - IIS Express Url 重写模块非常简单的重定向不起作用

转载 作者:行者123 更新时间:2023-12-01 15:54:28 24 4
gpt4 key购买 nike

我想将 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,并且它运行良好。

关于asp.net-mvc - IIS Express Url 重写模块非常简单的重定向不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30337229/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com