Posts Tagged apache
Deny directory listing on your blog/site
Posted by Hieu Trung in Web Development on October 25, 2008
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:
- 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.
- 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.