【问题标题】:Difficulty with simple ASP rewrite rule简单的 ASP 重写规则的困难
【发布时间】:2011-11-09 05:16:52
【问题描述】:

我有页面:

~/forum/forum_faq.html

在我的日志中,我看到了 404 个请求:

~/forum_faq.html

出于某种原因,所以我尝试用这个规则来修复它:

<rewrite url="~/forum_faq.html$" to="~/Handlers/PermRedirect.ashx?URL=forum/forum_faq.html" processing="stop" />

perm 重定向文件只是执行 301 重定向到给定位置。如果没有这条规则,我可以访问 forum/forum_faq.html 就好了。当我添加规则时,我得到一个:

这个网页有一个重定向循环网页在 http://127.0.0.1/forum/forum_faq.html 导致太多 重定向。清除本网站的 cookie 或允许第三方 cookie 可以解决问题。如果不是,它可能是一个服务器 配置问题,而不是您的计算机的问题。

有什么想法吗?

【问题讨论】:

  • 如果 url 是“~/forum_faq.html$”,处理程序编码重定向到哪里?
  • 论坛是 ASP.Net 应用程序吗?

标签: c# asp.net redirect url-rewriting


【解决方案1】:

怀疑正在发生的事情是Forum 是 IIS 中的 ASP.NET 应用程序。因此,您的 ~/forum_faq.html$ 匹配路径 /forums/forum_faq.html 通过您的处理程序发送它,然后在无限循环中重定向到 /forum/forum_faq.html

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-09-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-04-25
    • 1970-01-01
    相关资源
    最近更新 更多