Apache2.4内部服务器错误目录匹配 [英] Apache2.4 Internal Server Error DirectoryMatch
本文介绍了Apache2.4内部服务器错误目录匹配的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图保护.git和svn目录,因为任何人都可以访问它们,因为它们包含敏感的元信息。
I'm trying to secure the .git and svn directories from anyone being able to access them because they contain sensitive meta information.
我尝试使用遵循以下规则,但是我收到内部服务器错误,并且不确定原因:
I've tried using the following rule but I'm receiving an internal server error and I'm not sure why:
<Directorymatch "^/(.*/)*\.(git|svn)/">
Require all denied
</Directorymatch>
有什么想法吗?
推荐答案
根据Apache 2.4文档, 。$ access
您可以使用 mod_rewrite
指令在您的站点根目录.htaccess中执行相同的操作:
You can use mod_rewrite
directives to do the same in your site root .htaccess:
RewriteEngine On
RewriteRule \.(git|svn)(/.*)?$ - [F,NC]
这篇关于Apache2.4内部服务器错误目录匹配的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文