Zend Framework Rewrite对IIS7下的某些URL不起作用

时间:2014-08-06 19:09:00

标签: zend-framework iis-7 rewrite

我最近将基于Zend框架1编写的网站从Apache移到了IIS7。我按照Rob Allen http://akrabat.com/winphp-challenge/zend-framework-url-rewriting-in-iis7/的说明将规则导入IIS。

除了具有以下格式的网址外,一切正常:

www.example.com/products/download/productname-4.0.0.zip

它显示了IIS 404错误页面,而不是应用程序中的自定义404页面。我怀疑是IIS7配置问题。

任何人都有类似的经历吗?

1 个答案:

答案 0 :(得分:0)

这是我在IIS7中用于Zend Framework的web.config

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <rewrite>
            <rules>
                <rule name="Imported Rule 1" stopProcessing="true">
                    <match url="^.*$" />
                    <conditions logicalGrouping="MatchAny">
                        <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" />
                        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" />
                    </conditions>
                    <action type="None" />
                </rule>
                <rule name="Imported Rule 2" stopProcessing="true">
                    <match url="^.*$" />
                    <action type="Rewrite" url="index.php" />
                </rule>
            </rules>
        </rewrite>
    </system.webServer>
</configuration>