Thursday, June 21, 2012

mod_rewrite directive in http.conf

With CakePHP 1.x sites rather than use .htaccess files and associated performance hit on production machines I've always added a section to the apache virtual host config like this….

<Directory "/path/to/serverdocs/mysiteroot/app/webroot/">
Options All +MultiViews -ExecCGI -Indexes
AllowOverride None
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]
</IfModule>
</Directory>

Which has always worked fine.

Now I am switching to 2.x I read that the .htaccess file has changed, comparing old and new the only change I see is that the rewrite rule has changed from...

RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]

to...

RewriteRule ^(.*)$ index.php/$1 [QSA,L]

…so I changed this in my virtual host config but it doesn't work - I get the classic mod_rewrite not working sign of a plain page with no CSS. The old 1.x way with index.php?url=$1 still seems to work fine with my 2.x site.

So am I missing something here or should I stick with the old way?

Paul

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

No comments: