【问题标题】:How to Default Subdirectories to Allow from All, While Allowing Access to Home Page in Apache如何在 Apache 中允许访问主页时默认子目录允许全部访问
【发布时间】:2015-08-06 02:34:06
【问题描述】:

如何设置 httpd.conf 以使子目录在默认情况下不可访问,并且仍允许公共访问位于 /index.html 的主页?

我的目标是阻止对子目录的访问,但我的开发团队成员除外,但仍让公众在 /index.html 处看到主页

这是我在 httpd.conf 中的内容。它保护子目录,但是在根目录下没有人可以看到主页。

<Directory /path/to/home*>
    Order deny,allow
    Deny from all
</Directory>

<Directory /path/to/home/subdirectory-for-dev*>
    Order deny,allow
    Deny from all
    allow from 111.222.333.444 #developer 1's ip
    allow from 222.222.333.444 #developer 2's ip
    #etc.. for other developers
</Directory>

【问题讨论】:

    标签: apache httpd.conf


    【解决方案1】:

    我建议您尝试使用以下代码在您的子目录中创建 .htaccess 文件并再次检查。

    <FilesMatch "\.(html|htm|txt|jpg|jpeg)$">
    Allow from 111.222.333.444
    Allow from trustedsite.com
    Deny from all
    </FilesMatch>
    

    【讨论】:

      猜你喜欢
      • 2017-10-11
      • 2014-01-20
      • 1970-01-01
      • 2017-05-22
      • 1970-01-01
      • 2013-07-31
      • 1970-01-01
      • 2019-03-03
      • 1970-01-01
      相关资源
      最近更新 更多