Deny directory listing with htaccess?

If Options -Indexes does not work as Bryan Drewery suggested, you could write a recursive method to create blank index. Php files Place this inside of your base folder you wish to protect, you can name it whatever (I would recommend index. Php)?

Php recurse(". "); function recurse($path){ foreach(scandir($path) as $o){ if($o! = "." && $o!

= ".."){ $full = $path . "/" . $o; if(is_dir($full)){ if(!file_exists($full .

"/index. Php")){ file_put_contents($full ."/index. Php", ""); } recurse($full); } } } }?

These blank index. Php files can be easily deleted or overwritten, and they'll keep your directories from being listable.

If Options -Indexes does not work as Bryan Drewery suggested, you could write a recursive method to create blank index. Php files. Place this inside of your base folder you wish to protect, you can name it whatever (I would recommend index.

Php) These blank index. Php files can be easily deleted or overwritten, and they'll keep your directories from being listable.

1 Although an empty file is not that big of a deal, a better solution might be to use symbolic links, that way it saves a bit of space, and he would only need to modify 1 file if he chose to display some sort of uniform message instead of a blank page. – daalbert May 17 at 19:39.

Options -Indexes should work to prevent directory listings. If you are using a . Htaccess file make sure you have at least the "allowoverride options" setting in your main apache config file.

Try adding this to the . Htaccess file in that directory. Options -Indexes This has more information.

I'm Tested it, but unfortunately doesn't work . – D.A.V.O.O. D May 9 at 5:24.

For numerous security reasons it is a good idea to restrict directory listing, the default behavior in Apache. This can be done with a simple line in our htaccess file we can prevent visitors from seeing our directory listings. Now users who request a directory that doesn’t have an index file it will show them a 403 forbidden error page.

These are several of my favorite uses of htaccess. Leave yours in the comments! I am available for help in the comments or on twitter.

If there is a great deal of interest, I will do more htaccess tutorials with solutions to your requests in the comments. Thanks for reading! Follow us on Twitter, or subscribe to the NETTUTS RSS Feed for more daily web development tuts and articles.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions