# Deny access to .git directory RewriteEngine On RewriteRule ^(.*/)?\.git/ - [F,L] # Alternatively, you can use the following directive to deny access Order allow,deny Deny from all