Welcome to WebmasterWorld Guest from

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

Protect File Folders

Keeping the public from viewing content of folders



9:41 pm on Mar 26, 2006 (gmt 0)

10+ Year Member

How do I protect file folders like "stylesheets" "php scripts" etc, from exposing their directories to the public? If a visitors would come upon these folders, they would be able to see the content of the folder, and view the documents.

Thanks in Advance,


10:04 pm on Mar 26, 2006 (gmt 0)

10+ Year Member


they wont be able to see php scripts, but they will be able to see style sheets.

But ive no experience if there is solution to stop both from being public.


10:17 pm on Mar 26, 2006 (gmt 0)

10+ Year Member

You are absolutely correct about php scripts. I didn't mean to include it. I have a small comments board on my site, if you click on the directory/folder name, you'll see the entire content of the folder. How can I keep the directory hidden, without creating an index.php page? Is there another way to do this?

Thanks in advance,


11:26 pm on Mar 26, 2006 (gmt 0)

5+ Year Member

One way of doing it is to add .htaccess file to your folder and include this in it:

Options All -Indexes



11:33 pm on Mar 26, 2006 (gmt 0)

10+ Year Member

Thanks for your help!



1:39 pm on Mar 27, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member

It could get a bit nasty but I put index.php pages in all the folders redirecting them to different pages according to the folder they try to access. It works well.



Featured Threads

Hot Threads This Week

Hot Threads This Month