Hide .git repo with Apache

Snippet

Solution 2.

Don't allow apache to serve anything from the .git repo that might be in the DocumentRoot . This is great because it hides that there even IS a git repo on the webserver.

Add this to the .htaccess in the DocumentRoot after the RewriteEngine On line.

RedirectMatch 404 /\.git

Add new comment

Plain text

  • No HTML tags allowed.
  • Lines and paragraphs break automatically.