【问题标题】:iis 7.5 rewrite to friendly url issuesiis 7.5 重写为友好的 url 问题
【发布时间】: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


【解决方案1】:

我删除了这个位于顶层的重写规则,并以最简单的方式(没有长路径和 IP)在最深的文件夹 (ccc) 中实现它。它自动工作。

【讨论】:

    猜你喜欢
    • 2011-10-21
    • 2013-10-09
    • 1970-01-01
    • 2017-04-01
    • 2013-01-06
    • 2013-02-06
    • 2012-05-23
    • 2015-05-11
    • 1970-01-01
    相关资源
    最近更新 更多