views:

99

answers:

2

We use .htaccess a lot for URL redirections and other stuffs. Is this any kind of a threat for web security? What are the best practices for a .htaccess file?

+2  A: 

Above all else, make sure that the .htaccess file itself can't be downloaded, by blocking web access to .ht*. This is mostly on by default, but check, and if not, use:

<Files ~ "^\.ht">
 Order allow,deny
 Deny from all
 Satisfy All
</Files>
Dominic Rodger
This is part of the default configuration and should not be changed.
Gumbo
A: 

The actual .htaccess files don't really have have any known security issues beside what people have mentioned already regarding permissions.

Having said that, I've seen situations where the mod_rewrite rules were actually protecting the web application. Their code had SQL injections that were not exploitable due the mod_rewrite expression filtering the input.

pcp