我将我的 zend 项目从 Apache 移动到 IIS 7 并设置了 URL Rewrite。主页显示得很好,但没有加载 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>
这是原始的 mod_rewrite 规则
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteCond %{REQUEST_URI}::$1 ^(/.+)(.+)::\2$
RewriteRule ^(.*) - [E=BASE:%1]
RewriteRule ^(.*)$ %{ENV:BASE}index.php [NC,L]
有什么建议么?