我的IIS有问题。我似乎无法访问www.site.com/controller/method
在我的Zend项目文件夹中有:
-public
-application
-...
-web.config
网络。配置内容(指向公共/文件夹):
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Imported Rule 14" stopProcessing="true">
<match url="!'.(js|gif|jpg|png|css|txt)$" ignoreCase="false" />
<action type="Rewrite" url="public/index.php{R:1}" />
</rule>
<rule name="Imported Rule 15" stopProcessing="true">
<match url="^(.*)$" ignoreCase="false" />
<action type="Rewrite" url="public/{R:1}" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
在我的public/文件夹中,我有以下配置(在Zend文档中找到):
网络。配置内容:
<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>
我认为主要问题是规则14,但我不知道为什么它不起作用,如果我从公共文件夹中删除配置,没有影响。
任何关于如何解决这个问题的建议将非常有帮助,这是我在Windows服务器上的第一次部署。
您需要更改您的Imported Rule 14
如下:
<rule name="Imported Rule 14" stopProcessing="true">
<match url="'.(js|gif|jpg|png|css|txt)$" negate="true" ignoreCase="false" />
<action type="Rewrite" url="public/index.php{R:1}" />
</rule>
选项!
在这种情况下不起作用,所以使用negate="true"
代替