How do I disable CakePHP rewrite routing for a single folder so it can be used as a location for a second application?
.htaccess, cakephp
Solution
The following rule rewrites www.example.com and www.example.com/ to www.example.com/app/webroot/
RewriteRule ^$ app/webroot/ [L]
This rule rewrites www.example.com/* to www.example.com/app/webroot/*
RewriteRule (.*) app/webroot/$1 [L]
I would throw out your rule and update the wildcard regex in the last rule, `(.*)`, so that it matches any string which doesn't start with `bildbank`. Something like this might do the trick:
RewriteRule ((?!bildbank).*) app/webroot/$1 [L]
This converts the following strings:
cake
cake.htm
cake/test
bilder
bilder.htm
bilder/test
bildbank
bildbank.htm
bildbank/test
.. into:
app/webroot/cake
app/webroot/cake.htm
app/webroot/cake/test
app/webroot/bilder
app/webroot/bilder.htm
app/webroot/bilder/test
bildbank
bildbank.htm
bildbank/test
.. therefore, excluding your `bildbank` subdirectory.
Problem
I have a cakephp installation in the root of my domain. Now it turns out I need to put another app in there that will reside in a subdirectory. How do I disable the controller/model redirection in cake for just this directory? The current .htaccess in the root folder looks like this: ``` <IfModule mod_rewrite.c> RewriteEngine on RewriteRule ^$ app/webroot/ [L] RewriteRule (.*) app/webroot/$1 [L] </IfModule> ``` I've tried modifying it like this, but to no avail: ``` <IfModule mod_rewrite.c> RewriteEngine on RewriteRule ^bildbank$ /bildbank/ [L] RewriteRule ^$ app/webroot/ [L] RewriteRule (.*) app/webroot/$1 [L] </IfModule> ``` I am aware that this is a bit of a hack, but there's no way I can get the second app to play nice with cake.