[英]How to prevent direct access to files from browser?
I am working on a CI Application. 我正在研究CI应用程序。
Now I Have a folder in my project called base_ini , in which I have some config files. 现在,我的项目中有一个名为base_ini的文件夹,其中有一些配置文件。 I want to secure this file, so no can can view its content directly from browser.
我想保护此文件,因此无法直接从浏览器查看其内容。
So I tried this two ways: 所以我尝试了两种方法:
If I pass this in URl : www.example.com/base_ini I do get proper error message. 如果我在URl中通过了此方法:www.example.com/base_ini,我会得到正确的错误消息。 But still if from browser I pass this path www.example.com/base_ini/default.ini then I can view its content.
但是,即使从浏览器中我通过此路径www.example.com/base_ini/default.ini,也可以查看其内容。
How can I stop this access? 如何停止此访问?
Put below line in your htaccess file and put that file at www.example.com/base_ini/ (path) 在您的htaccess文件中的下面一行,然后将该文件放在www.example.com/base_ini/(路径)中
Options -Indexes 选项-索引
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.