Apache 目录权限

目录访问权限

输入用户名、密码后方可访问home目录下的文件:

httpd.conf
<Directory "D:/software/wwwroot/home">
    Options -Indexes MultiViews                #-Indexes 禁止目录索引
    AllowOverride AuthConfig
    Order Deny,Allow
    Allow from all
    Options All
    AllowOverride All
</Directory>

在home目录下放置.htaccess文件

.htaccess
authtype basic
authname "Please input the invitation code"        #输入框提示信息
authuserfile D:/software/wwwroot/home/.htpasswd    #指定用户名、密码文件存放位置
require valid-user
原文地址:https://www.cnblogs.com/java-koma/p/4275004.html