.htaccess 文件帮助

发布于 2024-09-28 13:14:07 字数 309 浏览 1 评论 0原文

要进入我的网站,用户需要在弹出的 .htaccess 框中输入密码。我还想限制对 .svn 目录的访问。密码部分工作正常,但是当我添加最后一点关于阻止访问 .svn 下的任何内容时,我无法访问我网站上的任何页面:/

AuthUserFile /path/to/.htpasswd
AuthType Basic
AuthName "Development Area"
Require valid-user

<DirectoryMatch .*\.svn/.*>
  Deny From All
</DirectoryMatch>

To enter my site users are required to enter their password in the .htaccess box that pops up. I also want to restrict access to the .svn directory. The password part is working fine but when I add the last bit about blocking access to anything under .svn I'm unable to access any page on my site :/

AuthUserFile /path/to/.htpasswd
AuthType Basic
AuthName "Development Area"
Require valid-user

<DirectoryMatch .*\.svn/.*>
  Deny From All
</DirectoryMatch>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

微凉徒眸意 2024-10-05 13:14:07
<DirectoryMatch "\.svn">

应该可以正常工作。参数应该是目录名称匹配的正则表达式,并且在这种情况下不需要前后的通配符。另外,您的配置问题可能只是未引用正则表达式。

<DirectoryMatch "\.svn">

should work just fine. The argument should be a regex against which the directory name is matched and the wildcarded characters before and after shouldn't be necessary in this case. Also, the problem with your config is probably just that the regex wasn't quoted.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文