I have a website url that looks something like this: www.test.com/folder1/test.html
If I change the url to www.test.com/folder1
I can see all the files and folders parallel to folder1. I don’t want people to be able to do this and see these folders and files. How can I block access to this?
2
Answers
Please change the document root. The file is located at
/etc/apache2/sites-available/000-default.conf
if you use Ubuntu.You need to turn off the Indexes option. You can do it in a .htaccess file for a directory, in the configuration file for the site in a <Directory> section, or the global configuration httpd.conf.
This will prevent the server from generating an navigable index of files.
Full documentation is here:
https://httpd.apache.org/docs/2.4/mod/core.html#options