如何写重写的.htaccess规则来允许新的文件夹的访问?重写、文件夹、如何写、规则

2023-09-02 11:29:24 作者:走召惡野侽子λ

目前的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>

问候

 
精彩推荐
图片推荐