Rajan
Rajan

Reputation: 2425

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?

Upvotes: 2

Views: 2760

Answers (1)

Mukund Bhut
Mukund Bhut

Reputation: 180

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

Options -Indexes

Upvotes: 3

Related Questions