Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/sockets/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 覆盖子文件夹中的htaccess文件_Php_.htaccess_Codeigniter - Fatal编程技术网

Php 覆盖子文件夹中的htaccess文件

Php 覆盖子文件夹中的htaccess文件,php,.htaccess,codeigniter,Php,.htaccess,Codeigniter,我使用的是Codeigniter,我已经将资源(CSS、JS、图像等)从应用程序文件夹中分离出来,放入如下文件夹:root/resources。CodeIgniter在根文件夹中具有典型的htaccess文件,其内容如下: RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond $1 !^(index\.php|images

我使用的是Codeigniter,我已经将资源(CSS、JS、图像等)从应用程序文件夹中分离出来,放入如下文件夹:root/resources。CodeIgniter在根文件夹中具有典型的htaccess文件,其内容如下:

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !^(index\.php|images|robots\.txt|css|docs|js|system)
RewriteRule ^(.*)$ /index.php?/$1 [L]
如果我想允许资源文件位于子文件夹中,位于应用程序文件夹中,如:/application/plugins/some\u plugin\u name/resources。我应该在上述资源文件夹中的htaccess文件中放入哪些内容,以允许我访问CSS、JS和其他资源文件,如图像等

这也是关于未来插件的,因此“some\u plugin\u name”文件夹可以是任何内容。

您只需要以下内容:

RewriteEngine On

通过打开子文件夹内的重写引擎,其规则(无)将优先于父目录中的任何规则

乔恩·林很接近,但还有一个额外的规则需要补充。下面是在resources文件夹中工作的完整htaccess文件。您可能希望将其添加到资源文件夹下的任何文件夹中(但我可能错了):


我发布自己的答案的原因是,事实上我花了30分钟才找到答案。

当我试图直接从浏览器访问style.css文件时,仍然会出现403禁止的错误。当它也链接到时,它显然不起作用。
RewriteEngine On
allow from all