Forum Moderators: phranque

Message Too Old, No Replies

"Protecting" the htaccess file.

Is this suitable code?

         

Broadway

9:44 pm on Aug 9, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



While reading about .htaccess files I saw mention of this code as a way of "protecting" the htaccess file itself.

<Files .htaccess>
Order Allow,Deny
Deny from all
</Files>

Any reason not to do this?

mack

9:57 pm on Aug 9, 2010 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



The htaccess should be protected by the apache configuration file. The following will generaly be found within the apache2.conf or httpd.conf


<Files ~ "^\.ht">
Order allow,deny
Deny from all
Satisfy all
</Files>


What this does is prevent a browser or client from being able to see or read the .htaccess or .htpasswd files.

Mack.

Broadway

12:36 am on Aug 10, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



thanks