.htaccess: Prevent users from seeing private directories!

Watch
Impact
0
This isn't really 'code,' but it's similar to code.

If you have include directories, template directories, or other private directories, why allow users to access them? Instead, use mod_rewrite!

If you have include/ and want to hide it, add this to your .htaccess file:

Code:
RewriteEngine On
RewriteRule ^include$ /dev/null
RewriteRule ^include/(.*)$ /dev/null

You can use that again, but just remove "RewriteEngine On" and change "include" to the directory you want to hide.

10,000,000 in 10,000,001 servers have mod_rewrite.

I would also like to note that all PHP scripts or Perl scripts can access the files, even with this.
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
Also, for people using cpanel, in he protect directories feature it will write an htaccess file for you.
 
0
•••
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back