How do you hide the folders in your websites publi

2020-07-18 05:57发布

问题:

I don't like how if you go to certain folders on my website that don't contain a .html file that it will list all the files in it. I don't want to give access to that. Such as: http://christianselig.com/css

How do I hide these?

回答1:

If you are using Apache webserver and have access to httpd.conf you can set "Options -Indexes" for directory which content you want to hide. If you have no access to httpd.conf you can create .htaccess file in directory which content you want to hide with "IndexIgnore *"



回答2:

You need to tell your webserver to stop directory listings. For apache, add this to your httpd.conf or any other related config file

<Directory /path/to/directory>
   Options -Indexes
</Directory>

If placed in a .htaccess file, AllowOverride Options must be enabled for the desired directory.