最近在运行Zend Framework的Windows服务器上设置了一个站点,只有index.php页面显示正确。所有其他内部页面看起来都被重定向到index.php,URL被重写为正确的页面URL。真的很奇怪,似乎无法弄清楚它是否是web.config中的服务器配置或退役规则。任何建议都将非常感激。 谢谢 鉴
答案 0 :(得分:0)
在带有IIS 7的Windows 2008 Server上,我在服务器根目录中为我的ZF应用程序提供了以下web.config文件(“C:\ intepub \ wwwroot”),它允许我以与上面相同的方式运行应用程序Linux服务器。
希望这有助于您和其他人使用IIS开始使用Windows。
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Get rid of the world wide web" enabled="true" stopProcessing="true">
<match url="^(.*)" ignoreCase="false" />
<conditions logicalGrouping="MatchAll">
<add input="{HTTP_HOST}" pattern="^www\.example\.com$" />
<add input="{HTTP_HOST}" pattern="^$" ignoreCase="false" negate="true" />
</conditions>
<action type="Redirect" url="http://example.com/{R:1}" redirectType="Permanent" />
</rule>
<rule name="Ignore files on the filesystem" stopProcessing="true">
<match url="^(.*)$" />
<conditions logicalGrouping="MatchAny">
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" />
<add input="{REQUEST_FILENAME}" matchType="IsFile" />
</conditions>
<action type="None" />
</rule>
<rule name="Point to the site entry gate" stopProcessing="true">
<match url="^.*$" />
<action type="Rewrite" url="public/index.php" logRewrittenUrl="true" />
</rule>
</rules>
</rewrite>
<defaultDocument>
<files>
<clear />
<add value="index.php" />
<add value="index.html" />
</files>
</defaultDocument>
</system.webServer>
</configuration>