gpt4 book ai didi

php - 如何限制我在 codeigniter 项目的根目录中创建的文件夹?

转载 作者:可可西里 更新时间:2023-11-01 16:31:55 25 4
gpt4 key购买 nike

我有一个 codeigniter 项目。如果我在 root direct 中创建一个默认情况下无法提供 codeigniter 框架的文件夹,如果我使用 base_url + folder_name( http://localhost/Magpie/css/ ) 访问 url,结果浏览器将显示所有文件文件夹 screenshot 附在下面:

How can i Manage this problem

enter image description here


Already I used a .htaccess file in project root directory. my .htaccess code in bellow :

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /Magpie/
RewriteCond $1 !^(index\.php|images|css|js|robots\.txt|favicon\.ico)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ ./index.php/$1 [L,QSA]
</IfModule>

最佳答案

用这个更新你的 .htaccess

我刚刚在你的 .htaccess 中添加了 Options -Indexes

<IfModule mod_rewrite.c>
Options -Indexes
RewriteEngine on
RewriteBase /Magpie/
RewriteCond $1 !^(index\.php|images|css|js|robots\.txt|favicon\.ico)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ ./index.php/$1 [L,QSA]
</IfModule>

关于php - 如何限制我在 codeigniter 项目的根目录中创建的文件夹?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51191410/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com