Nginx
Location ~ . *. (Svn | git | cvs ){
Deny all;
}
Apache
<Directory "/opt/www/svip/gift/webroot">
RewriteEngine On
RewriteRule. svn // 404.html
</Directory>
I sorted out some methods for your reference.
Prohibit access to some files/Directories
Add the Files option to control, for example, do not allow access to Files with the. inc extension, and protect the php class library:
<Files ~ ". Inc $">
Order allow, deny
Deny from all
</Files>
Prohibit access to some specified directories: (you can use it for regular expression matching)
<Directory ~ "^/Var/www/(. +/) * [0-9] {3}">
Order allow, deny
Deny from all
</Directory>
Prohibit by file matching, for example, prohibit all accesses to images:
<FilesMatch .(? I: gif | jpe? G | png) $>
Order allow, deny
Deny from all
</FilesMatch>
Prohibit access to the relative URL path:
<Location/dir/>
Order allow, deny
Deny from all
</Location>
Deny access to certain targets (which can be used for regular expression matching) in proxy mode. For example, deny access to 111cn.net through proxy:
<Proxy http://www.111cn.net/*>
Order allow, deny
Deny from all
</Proxy>