I need to disable that indexing when I enter on my root directory on a apache2 server, any tips?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
If it's only one directory that you want to protect from viewing contents, you can also just add an index.html or index.php that will show whenever someone browses to that directory.
回答2:
Edit your apache2 configuration file which normally is on the dir: "/etc/apache2/httpd.conf".
Add the following or edit if your already have some configurations for the default web server dir (/var/www):
<Directory /var/www>
Options -Indexes
AllowOverride All
Order allow,deny
Allow from all
</Directory>
This will disable the indexing to all the public directories.
回答3:
Usually done like this:
Options -Indexes
The minus means "no"...
回答4:
Make sure that you also add -Indexes to the config files in your sites-enabled (or sites-available as it was in my case) directory, they're usually inside the "/etc/apache2/" directory.