开发者

CakePHP on IIS7 - no css/js/img

开发者 https://www.devze.com 2023-01-01 09:27 出处:网络
I can’t get the css, js and img loaded. I’ve been using the web.config out of this article: http://book.cakephp.org/view/1开发者_如何学Python533/A-Note-on-mod_rewrite Please any suggestions…Insert

I can’t get the css, js and img loaded. I’ve been using the web.config out of this article: http://book.cakephp.org/view/1开发者_如何学Python533/A-Note-on-mod_rewrite Please any suggestions…


Insert this rule

<rule name="Imported Rule 0" stopProcessing="true">
    <match url="^(img|css|files|js)(.*)$" />
    <action type="Rewrite" url="/app/webroot/{R:1}{R:2}" appendQueryString="false" />
</rule>

together with the site rules for cakephp.org:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <rewrite>
            <rules>
                <rule name="Imported Rule 0" stopProcessing="true">
                    <match url="^(img|css|files|js)(.*)$" />
                    <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="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
                        <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
                    </conditions>
                    <action type="Rewrite" url="index.php?url={R:1}" appendQueryString="true" />
                </rule>
                <rule name="Imported Rule 3" stopProcessing="true">
                    <match url="^$" ignoreCase="false" />
                    <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>           
                <rule name="Imported Rule 1-1" stopProcessing="true">
                    <match url="^$" ignoreCase="false" />
                    <action type="Rewrite" url="/" />
                </rule>
                <rule name="Imported Rule 2-1" stopProcessing="true">
                    <match url="(.*)" ignoreCase="false" />
                    <action type="Rewrite" url="/{R:1}" />
                </rule>                  
            </rules>
        </rewrite>
    </system.webServer>
</configuration>


I had the same issue and after a few hours of research this is how i've fixed my problem: I've set the permissions to Full Control for Everyone on the CakePHP folder. After that i no longer needed any .htaccess files or web.config

0

精彩评论

暂无评论...
验证码 换一张
取 消