我正在使用受htaccess保护的目录的网站.我想创建一个自定义登录页面,而不是依靠浏览器的默认页面.有人对此有经验吗?
我想通过HTML表单进行连接.有人认为有可能吗?
谢谢.
解决方法:
是的,有可能,但是您不应该使用htaccess摘要身份验证,必须在HTML& PHP.
您可以在PHP&中实现类似的内容htaccess的
管理员/的.htaccess:
RewriteCond %{REQUEST_FILENAME} !check_auth.php
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule .* check_auth.php?file=$0 [QSA,L] # pass everything thru php
管理员/ check_auth.php:
$file = $_GET['file'];
if($_SESSION['user_authenticated']) {
// please mind you need to add extra security checks here (see comments below)
readfile($file); // if it's php include it. you may need to extend this code
}else{
// bad auth error
}
您可以像这样访问目录文件
check_auth.php?file=filename