【发布时间】:2015-06-05 22:49:51
【问题描述】:
我所有的图片和 css 网址,或在应用程序前呈现的网址
/app/favicon.ico
/app/img/logo.png
/app/css/styles.css
页面内容渲染良好,只是图像和 css 没有。
我的 web.config 看起来像这样,但似乎对这些 url 没有帮助。因此,它们都导致 404。
<rules>
<rule name="Rewrite requests to test.php"
stopProcessing="true">
<match url="^test.php(.*)$" ignoreCase="false" />
<action type="Rewrite" url="app/webroot/test.php{R:1}" />
</rule>
<rule name="Imported Rule 4" stopProcessing="true">
<match url="^(.*)$" ignoreCase="false" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
</conditions>
<action type="Rewrite" url="app/index.php?url={R:1}" appendQueryString="true" />
</rule>
<rule name="Exclude direct access to webroot/*" stopProcessing="true">
<match url="^app/webroot/(.*)$" ignoreCase="false" />
<action type="None" />
</rule>
<rule name="Rewrite routed access to assets(img, css, files, js, favicon)" stopProcessing="true">
<match url="^(img|css|files|js|favicon.ico)(.*)$" />
<action type="Rewrite" url="app/webroot/{R:1}{R:2}" appendQueryString="false" />
</rule>
<rule name="Imported Rule 1" stopProcessing="true">
<match url="^$" ignoreCase="false" />
<conditions logicalGrouping="MatchAll">
<add input="{URL}" pattern="^app/webroot/" ignoreCase="false" negate="true" />
</conditions>
<action type="Rewrite" url="app/webroot/" />
</rule>
<rule name="Imported Rule 2" stopProcessing="true">
<match url="^(.*)$" ignoreCase="false" />
<action type="Rewrite" url="app/webroot/{R:1}" />
</rule>
</rules>
生成的网址应该是
/favicon.ico
/img/logo.png
/css/styles.css
我在 iis 上的目录树是:
www
应用程序
网络根
【问题讨论】:
标签: php cakephp iis iis-7.5 cakephp-3.0