Page 1 of 1

Make Directory Not Accessible But Allow Read of its Files

Posted: 2014-04-05 06:00
by Sam.Z
Hello

Is it possible to not allow public reading of a directory but allow public reading of the files inside that directory?

Essentially I dont want people see navigate to http://www.example.com/Files/ and see a list all the files in that directory. Maybe I can achieve this by editting .htaccess? But it would be easier to edit the directory through Filezilla.

I have tried setting the directories permissions to disallow public read, write and execute. And setting a file inside that directory to allow public read, write, execute. But when I go to access the file it gives me a 403 error.

Re: Make Directory Not Accessible But Allow Read of its File

Posted: 2014-04-05 16:30
by boco
FileZilla is FTP, you cannot directly modify access rights for the HTTP server.

If you don't want anyone to see the files in your directories, make sure you have "Options -Index" inside your .htaccess files. Alternatively, that option has to be included in HTTP server directives. Public reading of the directory must be enabled or public cannot access it. Note that if index listings are not allowed and there's no valid index document in a directory, getting a 403 Forbidden error is perfectly normal.

Search the web for 'prevent index listings' (no quotes).