通过htaccess文件登录隐藏我的整个网站

时间:2017-07-29 20:05:34

标签: .htaccess

是否可以使用htaccess和htpasswd文件使用登录名和密码“隐藏”我的网站?

所以我只能在提示用户和密码时看到索引?

1 个答案:

答案 0 :(得分:1)

是。您必须在.htacess文件中使用类似的内容:

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

您可以使用此在线生成器来创建htpasswd文件: http://www.htaccesstools.com/htpasswd-generator/

注意:/ path / to / .htpasswd需要是绝对路径