skip to Main Content

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


  1. Please change the document root. The file is located at /etc/apache2/sites-available/000-default.conf if you use Ubuntu.

    Login or Signup to reply.
  2. 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.

     Options -Indexes
    

    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

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search