Skip to content

Instantly share code, notes, and snippets.

@mateuslopes
Created September 28, 2020 17:11
Show Gist options
  • Save mateuslopes/3dcf4b3caf4c29eecf5616570de9d275 to your computer and use it in GitHub Desktop.
Save mateuslopes/3dcf4b3caf4c29eecf5616570de9d275 to your computer and use it in GitHub Desktop.
Block access .git folders and files on Apache2 servers
# Put this into your httpd.conf to block access to any server .git folders and files
<DirectoryMatch "^/.*/\.git+/">
Order deny,allow
Deny from all
</DirectoryMatch>
<Files ~ "^\.git">
Order allow,deny
Deny from all
</Files>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment