-3

I have some files on my Linux Server, which is getting used on front-end. My directory structure is something like this.

dir1/
    dir1/
        file3.pdf
    dir2/
        file1.pdf
dir2/
    dir1/
        file1.pdf
        file2.pdf
        file3.pdf

All I want to do is put some restrictions on directories i.e if user some tries to access www.example.com/dir1 or www.example.com/dir1/dir1/ it should give 403 error , only single files should be available to user. for e.g. www.example.com/dir2/dir1/file1.pdf.

I tried chmod 644 dir1 but its giving 403 error for every file of that directory.

Suggest me a way to solve this problem recursively In one go

Magnotta
  • 101

1 Answers1

0

You have to disable indexing in apache conf file: https://wiki.apache.org/httpd/DirectoryListings

Ngix does this by default.

Dagon
  • 1
  • 1