【发布时间】:2013-03-16 16:07:42
【问题描述】:
我将我的 zend 项目从 Apache 移动到 IIS 7 并设置了 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>
这里是原始的 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]
有什么建议吗?
【问题讨论】:
-
您对 apache 使用的原始规则是什么?您的所有请求都发送到一个裸露的
public/index.php。
标签: iis-7 url-rewriting zend-framework2