Prevent Directory Listing Using .htaccess

I found some useful trick to prevent directory listing using .htaccess file :)

I’m currently working on some tasks to start building my list. Part of the tasks requires me to create a squeeze page, which will need me to create the thank you page and also download page. To do so, I have to create destination folders on my site to upload the files..

And as usual, I got sidetracked and do something else first ..talk abt focus.. sigh….

Being a curious catz, I tried index listing on my themes, plugin and some other directory, you know something like when you type in abc.com/wp-content/theme etc. … and to my horror,  i can see all my stuffs indexed… if I can see it, others should be able to do it also. Imagine if I created a download people, some clever folks would be able to nick it by checking my index listing…

So, off the rookie warrior searching high and low in Google trying to fix this. And I found some interesting suggestions to prevent directory/folder indexing including blank html file and also modifying the .htaccess file in the root directory.

So, I choose the easier one which I think is modifying .htaccess file. I think you should do it too…

It is pretty simple really..

1) From cpanel, access the file manager and go to the .htaccess file, edit it

2) Add in this line:  options -indexes at the beginning and save the files

What this does is it doesn’t allow indexing of the folders, so if your .htacess file is in the root folder it will prevent the subfolders from being listed too.. I tried it and when I try to check the folders using listing it is no longer there.. it said “file not found” .. useful trick…  i find that it might be more useful to also add in metarefresh/redirect to the main page but I haven;t figure out how to do it yet…

and now .. back to creating my squeeze page :)

Socrates Theme

Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • NewsVine
  • Reddit
  • StumbleUpon
  • Google Bookmarks
  • Yahoo! Buzz
  • Twitter
  • Technorati
  • Live
  • LinkedIn
  • MySpace
  • MySpace

Post to Twitter

No related posts.



Leave a Reply

Security Code: