Disable directory browsing with htaccess

on my server I have a series of folders. I would deny access to all of these folders. How can i do Which rule should I use?

+4
source share
2 answers

add one line to your .htaccess root:

deny from all 

@QUESTION:

if you want to keep access for yourself:

 allow from 192.168.1.1 

subscribe to your real IP address as shown in the example.

so all together:

 deny from all allow from YOUR_IP 

@ question2:

if you deny access to a directory, you deny access to all sites in this directory, for example, "pages". if you say that you want to deny access to a folder in a directory of the same level as the pages, move htaccess inside this folder (simple)

@EDIT:

Open the .htacces file
Parameter Index Search
If Indexes options exist, change it to Options -Indexes or add -Indexes Options as a new line
Directory browsing should now be disabled.

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

+5
source

Add this to your .htaccess file,

 Options -Indexes 
+4
source

Source: https://habr.com/ru/post/1400492/


All Articles