How to limit mod_rewrite to a single directory?

Is this approach of limiting users' access to directory listing correct?

  • I'll definitely configure the web server to limit the access to the directory listing. But if such circumstances occur that I'm not able to, I've decided to put a file named, 'index.php' in all the directories, which will redirect to the home page. Will this be secure or it might have some corner case(s)?

  • Answer:

    Yes - If access to directory only means listing of files. No - if by any means attacker finds the name of the files inside.

Tejas Jayasheel at Quora Visit the source

Was this solution helpful to you?

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.