Iis 7 Zend Framework 2 IIS url重写

Iis 7 Zend Framework 2 IIS url重写,iis-7,url-rewriting,zend-framework2,Iis 7,Url Rewriting,Zend Framework2,我将我的zend项目从Apache移动到IIS7,并设置URL重写。 主页显示的很好,但是css和javascript没有加载 这是我的重写脚本 <?xml version="1.0" encoding="UTF-8"?> <configuration> <system.webServer> <defaultDocument> <files> <

我将我的zend项目从Apache移动到IIS7,并设置URL重写。 主页显示的很好,但是css和javascript没有加载

这是我的重写脚本

<?xml version="1.0" encoding="UTF-8"?>
    <configuration>
    <system.webServer>
        <defaultDocument>
            <files>
                <clear />
                <add value="index.php" />
            </files>
        </defaultDocument>
        <rewrite>
            <rules>
                <rule name="Imported Rule 1" stopProcessing="true">
                    <match url="^.*$" />
                    <conditions logicalGrouping="MatchAll">
                        <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
                    </conditions>
                    <action type="Rewrite" url="public/index.php" />
                </rule>
                <rule name="Imported Rule 1-1" stopProcessing="true">
                    <match url="\.(js|ico|txt|gif|jpg|png|css)$" ignoreCase="false" negate="true" />
                    <action type="Rewrite" url="public/index.php" />
                </rule>
            </rules>
        </rewrite>
    </system.webServer>
</configuration>

有什么建议吗?

在浏览Zend2文档之后,我发现了这个示例。很好用!我希望这能帮助其他人

<?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" pattern=""
                         ignoreCase="false" />
                     <add input="{REQUEST_FILENAME}"
                         matchType="IsDirectory"
                         pattern="" 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>


您在apache中使用的原始规则是什么?您的所有请求都会发送到一个空的
public/index.php
。我确信它可以组合成一个规则,但如果它是这样工作的话…:)@aserwin嗨,你能告诉我你是怎么让ZF2在IIS7上工作的吗?我按照指南添加了URL重写,但似乎URL重写从未完成。有什么建议吗?这对我来说也很有效,我试图将.htaccess文件转换成重写规则,真是累死我了。谢谢@aserwin!!!
<?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" pattern=""
                         ignoreCase="false" />
                     <add input="{REQUEST_FILENAME}"
                         matchType="IsDirectory"
                         pattern="" 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>