开发者

How to write rewrite .htaccess rule to allow new folder access?

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


An alternative to modifying the .htaccess rules is to move your site folder to app/webroot/.


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜