Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disable Directory Browsing using htaccess

Tags:

.htaccess

in my server I have a series of folders. I would deny the access to all this folders. How can I do? What rule I have to use?

like image 936
Mazzy Avatar asked Dec 28 '22 04:12

Mazzy


2 Answers

add one line in your .htaccess root:

deny from all

@QUESTION:

if you want to retain access for yourself:

allow from 192.168.1.1

subsitute in your real IP for the one i gave in the example.

so all together:

deny from all
allow from YOUR_IP

@QUESTION2:

if you deny access to a directory, you are denying access to all of the nodes in that directory like the "pages". if you are saying you want to deny access to a folder in the same level directory as the pages, move the htaccess to inside of that folder (simplest)

@EDIT:

Open your .htacces file
Look for Options Indexes
If Options Indexes exists modify it to Options -Indexes or else add Options -Indexes as a new line
The directory browsing feature should be disable by now

http://www.techiecorner.com/106/how-to-disable-directory-browsing-using-htaccess-apache-web-server/

like image 194
Dan Kanze Avatar answered Jan 13 '23 12:01

Dan Kanze


Add this to your .htaccess file,

Options -Indexes
like image 21
php Avatar answered Jan 13 '23 12:01

php