homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

Protect File Folders
Keeping the public from viewing content of folders

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

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)


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)

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)

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)

Thanks for your help!



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

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.


Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved