How to Not Allow Directory Listings

Posted in Hosting on March 14th, 2008

Justin RainsWelcome! Thank you for visiting!
Follow me at Twitter
Subscribe to my full feed.

Some web hosts allow a directories contents to be displayed if there is no index file contained within that directory. This could cause a serious problem if that directory contained any sort of sensitive materials. If your hosting account is on a Unix or Linux server this problem is fairly easy to eliminate using a file called .htaccess. On my Windows PC I create a
new text document called htaccess.txt and within that file I put the following line:

Options -Indexes

That tells the webserver not to allow directory listings. I then upload the htaccess.txt file into the root folder for my domain and go in through a web based file browser or shell and rename the file to .htaccess . Windows will not let a file not have a name and just an extension so this is the simplest way to do it.

Some webmasters will also create an index page for every directory but if there are alot of directories this could take time. Using the htaccess file protects every directory in the site.


Related Posts:



If you found this page useful, consider linking to it.
Simply copy and paste the code below into your web site (Ctrl+C to copy)
It will look like this: How to Not Allow Directory Listings

No Comments »

No comments yet.


RSS feed for comments on this post. TrackBack URI



Leave a comment




  • I Share

      Share Feed: Subscribe
  • Recent Visitors

  • Blogroll

  • Cool Stuff