0

I'm trying to get CakePHP 2.0 to work on my Win2k laptop at home but have been stymied by mod rewrite issues. For previous versions of Cake (1.2, 1.3) I used ISAPI_rewrite with the following rule (my app is in a virtual folder 'cake'):

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

However this doesn't seem to work on CakePHP 2.0. If I enter the base directory 'localhost/cake/' I get the standard Cake welcome screen (tmp dir status, etc...) and it says everything is configured correctly. If I type in 'localhost/cake/widgets/index' it churns a bit and then just goes back to the standard screen that says everything is OK. No errors, nada.

This isn't the first time I've had problems with IIS, but I'm stuck with this laptop for a while longer. Any help would be appreciated.

Matt
  • 1,328
  • 1
  • 16
  • 28

2 Answers2

1

as I already answered here: http://groups.google.com/group/cake-php/browse_thread/thread/c266c5227b16dab7

it should read:

index.php?/$1
mark
  • 21,691
  • 3
  • 49
  • 71
  • Thanks, I was progressing through the various combinations and this post was one of my first, the other post was a little closer to being correct. Unfortunately "index.php?/$1" doesn't work either (yet), but I'm looking at your google groups comment to see if I understand it. – Matt Nov 08 '11 at 01:22
  • For posterity - this is what it should be "RewriteRule ^(.*)$ index.php/$1 [QSA,L]", without the "?" after index.php. – Matt Nov 08 '11 at 01:47
  • Well, you can leave it out, of course. But the official version contains it!!! thats probably due to backwards compatability to non-mod-rewrite users. And it should work both with and without the ? – mark Nov 08 '11 at 15:03
0

This worked for me:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <rewrite>
            <rules>

                <rule name="Redirect plugin resources" stopProcessing="true">
                  <match url="^(.*)/(ico|img|css|files|js)(.*)$" />
                  <action type="Rewrite" url="app/plugin/{R:1}/webroot/{R:2}{R:3}" appendQueryString="false" />
                </rule>
                <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>

            </rules>
        </rewrite>
    </system.webServer>
</configuration>
dtakis
  • 571
  • 1
  • 9
  • 30