我有一个域名为example.com
。 example.com
链接到Tumblr博客。 sub.example.com
指向我家的Ubuntu服务器的Apache服务器。我还在整个sub.example.com
(也就是说,用户可以在任何网页使用http
或https
之间选择)中选择性地启用SSL。 sub.example.com/directory
是.htaccess保护。我可以在http://sub.example.com/directory
上很好地访问目录,但不能在https://sub.example.com/directory
上访问目录。在https
版本上,系统提示我输入登录信息。有一次,我进入了我的凭据,我得到这个错误:为什么.htaccess受保护的目录在http上工作,但不在https上?
Error: File Not Found File Not Found.
我不知道发生了什么错误。以下是完整的/var/www/html/directory/.htaccess
文件和/etc/apache2/apache2.conf
文件的选定部分。
的.htaccess:
AuthType Basic
AuthName "Password Protected Area"
AuthUserFile /var/www/.htpasswd
Require valid-user
apache2.conf:
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
我在Ubuntu 14.10和Apache 2.4.10
HTTPS在受保护的目录之外正常工作。 使用HTTP时可以通过密码访问该目录。 由于HTTPS在'sub.example.com'上正常工作,因此SSL(假定)配置正确。 – 2015-02-12 16:40:44