【发布时间】:2013-02-02 20:32:26
【问题描述】:
我正在从 apache 迁移到 iis,并且遇到了 url 重写的问题。
我想要这样的所有请求:
http://192.168.0.44/aaa/bbb/ccc/testword
查询这个不友好的网址:
http://192.168.0.44/aaa/bbb/ccc/index.php?word=testword
所以我的 web.config 是:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="RewriteUserFriendlyURL1" stopProcessing="true">
<match url="^192\.168\.0\.44/aaa/bbb/ccc/([^/]+)/?$" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="192.168.0.44/aaa/bbb/ccc/index.php?word={R:1}" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
但是当我访问这样的 url 时,我得到一个 404 not found 错误。详情:
Module IIS Web Core
Notification MapRequestHandler
Handler StaticFile
Error Code 0x80070002
Requested URL http://192.168.0.44:80/aaa/bbb/ccc/testword
Physical Path C:\inetpub\wwwroot\aaa\bbb\ccc\testword
Logon Method Anonymous
Logon User Anonymous
我做错了什么?
附言那里会有一个域而不是那个ip,只是我想先在本地测试它,然后再上线。
重写模块 2 已安装。我可以在 iis manager gui 中看到。
提前致谢。
【问题讨论】:
-
请关闭,已解决
-
如果您可以发布您的解决方案作为答案并接受它,那就更好了。
标签: iis url-rewriting iis-7.5 rewrite