Requirements and Prerequisites

For this guide, we'll be setting up a 32-bit Windows Server 2003 environment with PHP under FastCGI and will connect to a MS SQL Server 2005 database. For URL Rewriting, I'm using the freeware edition of ISAPI_Rewrite 3. There are specific limitations related to using the freeware edition of this product - namely you can only set up server-wide rules. Therefore if you're hosting non-Cake applications on the same server, this particular product won't work for you (or you'll have to dish out for the retail version).

Finally you'll need administrator level access on the server in order to install each piece of software and configure permissions. This guide also assumes you have some knowledge of administering an IIS server (creating sites, handling domains, setting permissions).

Configuring ISAPI Rewrite

Download the ISAPI Rewrite freeware edition and run the installer. Once it's finished, navigate to the install directory (ie C:/Program Files/Helicon/ISAPI_Rewrite3) and run "Helicon Manager.exe". Click on "IIS Web Sites" in the left navigation and then on the "Edit" button.

Paste the following rewrite rules and save:

RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?url=$1 [L,QSA]

上面这个rewrite如果不好使,试试下面的.我就是上面的不好使,用的下面的ok了!!!

# Helicon ISAPI_Rewrite configuration file
# Version 3.1.0.82
RewriteEngine on
RewriteRule ^/(img|css|files|js)(.*)$ /app/webroot/$1$2 [L]

RewriteRule (.*?\.php)(\?[^/]*)?/([^/]*)/(.*) $1(?2$2&:\?url=/$3/$4)
RewriteRule ^/(.*) /index.php?url=/$1 [L]
RewriteRule /(.*) /$1