Apache2 仅允许访问apache目录中的登录页
我在Linux Mint中通过使用apache2中的mod_auth_表单和/etc/apache2/apache2.conf中的配置对我的网页进行了密码保护:Apache2 仅允许访问apache目录中的登录页,apache2,Apache2,我在Linux Mint中通过使用apache2中的mod_auth_表单和/etc/apache2/apache2.conf中的配置对我的网页进行了密码保护: <Directory "/var/www/html"> AuthFormProvider file AuthType form AuthName "Reserved Area" Session On SessionCookieName session path=/ requir
<Directory "/var/www/html">
AuthFormProvider file
AuthType form
AuthName "Reserved Area"
Session On
SessionCookieName session path=/
require valid-user
AuthFormLoginRequiredLocation "http://localhost/login.php"
# This is the login page
ErrorDocument 401 /login.php
# This is the file containing users login data
AuthUserFile /var/www/html/users/users
</Directory>
AuthFormProvider文件
AuthType表单
AuthName“保留区域”
关于
sessionokiename会话路径=/
需要有效用户
AuthFormLoginRequiredLocation“http://localhost/login.php"
#这是登录页面
ErrorDocument 401/login.php
#这是包含用户登录数据的文件
AuthUserFile/var/www/html/users/users
当未经授权的用户试图访问网页上的内容时,他将被重定向到登录页面“login.php”,但他也无法访问此页面,因此我尝试添加:
<Location /var/www/html/login.php>
Order Allow,Deny
Allow from all
</Location>
命令允许,拒绝
通融
但问题仍然存在,它只是试图无限地重定向到登录页面。什么可以让用户只访问登录页面而不访问站点上的任何其他内容?我发现如果
<Location /var/www/html/login.php>
Order Allow,Deny
Allow from all
</Location>
也改为:
ErrorDocument 401 /login/login.php
ErrorDocument 401 /login.php
ErrorDocument 401 /login/login.php