我所有的網址,圖片和CSS或應用程序所呈現前置CakePHP的3.0 IIS的web.config
/app/favicon.ico
/app/img/logo.png
/app/css/styles.css
頁的內容呈現精細,只是沒有圖像和CSS。
我的web.config看起來像這樣,但似乎沒有幫助這些網址。因此,他們都是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
應用
根目錄
它的正常工作 – Anuj
請不要發佈純代碼的答案。也添加一些描述 –