1

I don't want the user to see the sub directory structures. So I am thinking of redirecting the user to the homepage whenever they try to access that.

anirban.at.web
  • 349
  • 2
  • 11
  • You can prevent users from accessing empty directories in web server configuration. – cakan Dec 02 '15 at 12:49
  • 1
    Yes you can do this. But the problem is when ever you create a directory you need to put index.php. Better approach would be using `htaccess` to prevent directory listing. http://stackoverflow.com/questions/1229127/preventing-directory-listing-by-redirecting – Tintu C Raju Dec 02 '15 at 12:49
  • 1
    htaccess definitely is an alternative, but you may want to read this: https://www.nginx.com/resources/wiki/start/topics/examples/likeapache-htaccess/ (in short, using htaccess isn't free either) – fvu Dec 02 '15 at 13:38

1 Answers1

3

you can just put .htaccess file with Options -Indexes in it in root directory.

How do I disable directory browsing?

Community
  • 1
  • 1
Alex Babak
  • 489
  • 3
  • 15