I'm a new CakePHP user. I developed an application with CakePHP 1.3.5 that works fine locally with WAMP. I uploaded it to a web server running IIS. All CakePHP files are located in 1 folder and not in the root of the server. I followed the CakePHP "URL Rewrites on IIS7" guide in the 1.3 Cookbook. URL Rewrite Module 2.0 is running as part of IIS on the server. I created t开发者_StackOverflow中文版he web.config file in my CakePHP folder. The CakePHP pretty URLs seem to be working fine. I am able to run the application. However, no CSS stylesheets seem to be working, not the generic one, nor the ones in my themed folder. Would anyone happen to know what the problem might be?
Thanks in advance for your help.
Wild guess: It doesn't work in Firefox, but works in IE and other browsers?
Then it's most likely that you're not sending the text/css
content-type
header in your CSS files.
URL Rewrites on IIS7 (Windows hosts)
IIS7 does not natively support .htaccess files. While there are add-ons that can add this support, you can also import htaccess rules into IIS to use CakePHP’s native rewrites. To do this, follow these steps: 1.Use Microsoft’s Web Platform Installer to install the URL Rewrite Module 2.0 or download it directly (32-bit / 64-bit).
2.Create a new file in your CakePHP root folder, called web.config.
3.Using Notepad or any XML-safe editor and copy the following code into your new web.config file...
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Redirect static resources" stopProcessing="true">
<match url="^(ico|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="IsFile" negate="true" />
</conditions>
<action type="Rewrite" url="index.php?url={R:1}" appendQueryString="true" />
</rule>
<rule name="Imported Rule 2" stopProcessing="true">
<match url="^$" ignoreCase="false" />
<action type="Rewrite" url="/" />
</rule>
<rule name="Imported Rule 3" stopProcessing="true">
<match url="(.*)" ignoreCase="false" />
<action type="Rewrite" url="/{R:1}" />
</rule>
<rule name="Imported Rule 4" stopProcessing="true">
<match url="^(.*)$" ignoreCase="false" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
</conditions>
<action type="Rewrite" url="index.php?url={R:1}" appendQueryString="true" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
精彩评论