Archive for ‘Web Development’ category

Deny directory listing on your blog/site

25 October, 2008 | Hieu Trung | 2 Comments

Directory listing might be harmful to your site because others can browse and download all files in your directories. Preventing this problem is less than easy with 2 basic ways:

  1. Use blank index file: In most case, your web server will load the file named index.html in a directory by default when it’s called by the browser. So just upload a blank index.html to the directories which you don’t want to be listed. After that, your server will response a blank page instead of listing that directory when it’s called.
  2. Use .htaccess file: upload a file named .htaccess which contains only: Options -Indexes on your root directory. If you already have a .htaccess with other contents in it, simply edit and add 1 more row like above. All your directories are inaccessible from now on, a 403 page will be shown instead.