DIEthumb

Quick Tip: Prevent listing of files in your site’s sub-directories

If you are using Apache web server chances are that it is configured by default to show an index of available files in a directory if the standard index files; index.php or index.html are not available in that particular directory.

To avoid such behavior and prevent listing of files in a sub-directory of your site, you can of course configure Apache using .htaccess rules but there is an extremely simple solution that works just as well.

Simply create a blank index.php or index.html file and place it in your directory that you do not want other people (read creepy developers) to know all the contents of! It works very well. This way now when a user tries to access the sub-directory, he will be shown a blank page instead of the index of files and folders!

Some situations where you can use this is to hide the contents of a folder that contains downloadable goodies, or some directory that contains precious scripts that you don’t want everyone to see.

Admin

I am a student of Computer Engineering and a freelance web designer and developer with a passion for interface design. WordPress is my framework of choice and I also build web and mobile applications. My Google+ Profile

One response to this entry

  • Placing the above code in your .htaccess file will cause this to happen. When a user types in yoursite.com, your site will look for home.html in your root directory, find it, and load that page as the default page. If it does not find home.html, it will then look for index.php; if it finds that one, it will load it, if not, it will look for index.shtml and the whole process repeats until it finds a file it can use. The list of files is read from left to right.

    Reply / Quote

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

© 2014 All rights reserved | Powered by WordPress
Back to top ↑
Theme by dynamicguru.com