问题
The current cakephp .htaccess rules reroute all incoming requests to the app/webroot folder. See following rule:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^$ app/webroot/ [L]
RewriteRule (.*) app/webroot/$1 [L]
</IfModule>
At the moment I still developing and I have created a "site" folder in the cakephp root folder. But when I try to access the folder from the browser I get redirected to due the cakephp rewrite. I've done some research but I can't seem to figure out the required regular expression to change the rule. How do I modify/append the .htaccess folder to allow access to the 'site' folder.
Regards
回答1:
An alternative to modifying the .htaccess rules is to move your site
folder to app/webroot/
.
回答2:
You can do like this
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_URI} !^/path/to/cake_root/site
RewriteRule ^$ app/webroot/ [L]
RewriteCond %{REQUEST_URI} !^/path/to/cake_root/site
RewriteRule (.*) app/webroot/$1 [L]
</IfModule>
Regards
来源:https://stackoverflow.com/questions/5538181/how-to-write-rewrite-htaccess-rule-to-allow-new-folder-access