简体   繁体   English

web.config上的IIS 7 URL重写模块

[英]IIS 7 url rewrite module on web.config

can anybody help me with this please. 有人可以帮我吗 I have IIS7 and the hosting says that the URL Rewrite module has been installed already. 我有IIS7,主持人说URL Rewrite模块已经安装。 I even put into the bin directory the Microsoft.Web.Iis.Rewrite.dll 我什至将Microsoft.Web.Iis.Rewrite.dll放入bin目录

i can only use the web.config for the url rewrite configuration since I dont have access to the IIS manager (hosting restriction). 由于我无权访问IIS管理器(托管限制),因此我只能将web.config用于url重写配置。

here is my code on the web.config: 这是我在web.config上的代码:

    <system.webServer>
 <rewrite>
    <rules>
      <rule name="Rewrite to list_cities.aspx">
    <match url="^/state/([a-zA-Z]+)" />
    <action type="Rewrite" url="~/list_cities.aspx?state={R:1}" />
      </rule>             
   </rules>
 </rewrite>  
</system.webServer>  

I still get the error, HTTP Error 404.0 - Not Found, when i go to http://xxxxxxxx.com/state/CA/ . 当我转到http://xxxxxxxx.com/state/CA/时,仍然收到错误HTTP错误404.0-未找到。 I have already searched the issue but I cant seem to find any solutions. 我已经搜索过该问题,但似乎找不到任何解决方案。

Can anybody please check my code. 有人可以检查我的代码吗? Thanks a lot. 非常感谢。

I found the solution just now (not being an IIS expert...) Change {R:1} for {R:0} 我刚刚找到了解决方案(不是IIS专家...)将{R:1}更改为{R:0}

     <system.webServer>
 <rewrite>
    <rules>
      <rule name="Rewrite to list_cities.aspx">
    <match url="^/state/([a-zA-Z]+)" />
    <action type="Rewrite" url="~/list_cities.aspx?state={R:0}" />
      </rule>             
   </rules>
 </rewrite>  
</system.webServer> 

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

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