trhhrth 发表于 2014-9-23 10:16:51

apache与nginx优雅屏蔽svn与git目录

apache:

在httpd.conf文件中增加:index.php可更换为站点具体页面
也可以解决站点配置文件在vhosts目录下的情况。

<DirectoryMatch .*\.svn|.git|_svn/.*>
RewriteEngine On
RewriteRule ^(.*)(\.svn|.git|_svn)(/.*)$ /index.php
</DirectoryMatch>


nginx:
在nginx.conf中增加:

      location ~^(.*)\/\.svn|.git|_svn\/{

       rewrite ^(.*)(\.svn|.git|_svn)(/.*)$ /index.phpbreak;

      }
页: [1]
查看完整版本: apache与nginx优雅屏蔽svn与git目录