简体   繁体   中英

How to prevent direct access to files from browser?

I am working on a CI Application.

Now I Have a folder in my project called base_ini , in which I have some config files. I want to secure this file, so no can can view its content directly from browser.

So I tried this two ways:

  1. Put an index.html saying that Directory access is forbidden .
  2. I put a .htaccess file in that folder with Deny from all

If I pass this in URl : www.example.com/base_ini I do get proper error message. But still if from browser I pass this path www.example.com/base_ini/default.ini then I can view its content.

How can I stop this access?

Put below line in your htaccess file and put that file at www.example.com/base_ini/ (path)

Options -Indexes

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM