G
G
GennadyPHP2018-07-04 17:48:31
Apache HTTP Server
GennadyPHP, 2018-07-04 17:48:31

How to disable directory browsing?

How to configure .htaccess so that the user cannot open a directory and see the contents of the folder. The variant with installation of the rights through FTP is not good. Moreover, this error allows you to view even php files.

Answer the question

In order to leave comments, you need to log in

5 answer(s)
G
GennadyPHP, 2018-07-05
@GennadyPHP

I found the solution in one of the Runion topics. In all directories with php files it was necessary to create .htaccess with deny from all. Thanks to everyone who posted replies

D
Dmitry, 2020-12-30
@reservist

It is enough to add just one simple line to .htaccess at the root of the site:

# запрет выдачи листинга
Options -Indexes

C
CityCat4, 2018-07-04
@CityCat4

The simplest way is to create index.html with zero size. Then Apache will show it - and it's empty :)

A
Alexey P, 2018-07-04
@lynxp9

chmod -R 700 secret-dir
chown -R root secret-dir

V
Viktor Taran, 2018-07-05
@shambler81

View through what?
through the browser fork files? - then this is one error
You can open the body of the php file - this is another error You can
even go to this folder - this is another error

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question