Dennis Hackethal
Dennis Hackethal

Reputation: 14295

Hide open directory

I have a website and right now users can just open a directory and see all files in it. How do I disable that?

I was thinking about the php.ini file, or generally any php configuration that might do the trick (it is an Apache server run with PHP).

Upvotes: 1

Views: 139

Answers (2)

Eddy Freddy
Eddy Freddy

Reputation: 1816

Put a text file named .htaccess to your root-dir of your website or the dir you want to hide with following content:

Options -Indexes

Upvotes: 1

poncha
poncha

Reputation: 7866

Disable Indexes option in apache configuration.

Put this either in your httpd.conf or .htaccess in the root of the site.

Options -Indexes

This way, if the folder does not have an index page, the user will get a 403 Forbidden error.

Upvotes: 2

Related Questions