简体   繁体   English

为什么此重写规则不起作用?

[英]Why is this rewrite rule not working?

I am using ASP.NET URL Rewrite module and wrote this rule : 我正在使用ASP.NET URL重写模块并编写了以下规则:

  <rewrite>
      <rules>
          <rule name="test">
              <match url="http://localhost/ElWazefa/User/Ahmed/ahmed.aspx"/>
              <action type="Rewrite" url="http://localhost/ElWazefa/ahmed.aspx"/>
          </rule>
      </rules>
  </rewrite>

But it doesn't work. 但这是行不通的。

using asp.net 3.5 and XML IntelliSense for URL Rewrite 2.0 使用asp.net 3.5和XML IntelliSense进行URL重写2.0

Thanks in advance. 提前致谢。

I think your URLs can't include the protocol/host/port portion. 我认为您的网址不能包含协议/主机/端口部分。 Try: 尝试:

  <rewrite>
      <rules>
          <rule name="test">
              <match url="/ElWazefa/User/Ahmed/ahmed.aspx"/>
              <action type="Rewrite" url="/ElWazefa/ahmed.aspx"/>
          </rule>
      </rules>
  </rewrite>

the code syntax seems to be correct 代码语法似乎是正确的

try to check your URLs for typos or leave the port/host out of the URL like that: "/ElWazefa/User/Ahmed/ahmed.aspx" 尝试检查您的URL是否存在拼写错误,或者将端口/主机保留在URL之外,例如:“ / ElWazefa / User / Ahmed / ahmed.aspx”

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM