如何写重写的.htaccess规则来允许新的文件夹的访问? [英] How to write rewrite .htaccess rule to allow new folder access?

查看:98
本文介绍了如何写重写的.htaccess规则来允许新的文件夹的访问?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目前的CakePHP的.htaccess规则重新路由到应用程序/ Web根目录文件夹中的所有传入的请求。请参见下面的规则:

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>

目前,我仍处于发展阶段,我已经创造了CakePHP的根文件夹中的网站文件夹中。但是,当我尝试从浏览器访问该文件夹我重定向到由于CakePHP的重写。我做了一些研究,但我似乎无法找出需要定期EX pression改变规则。如何修改/追加的.htaccess文件夹允许访问网站文件夹。

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.

问候

推荐答案

您可以这样做

<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>

问候

这篇关于如何写重写的.htaccess规则来允许新的文件夹的访问?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆