PHP授权用户重定向头位置


php auth user redirect header location

这对我工作了很长时间,突然它停止工作。我有一个。htaccess和。htpasswd在同一个文件夹(用户)下面是index.php文件

<?
if(isset($_SERVER['PHP_AUTH_USER'])) { 
header("Location: http://website.com/users/".$_SERVER['PHP_AUTH_USER']); 
    } 
else header("Location: http://website.com/failed_login"); 
?>

试试这个

<?php
if(isset($_SERVER['PHP_AUTH_USER'])) { 
   header("Location: http://website.com/users/".$_SERVER['PHP_AUTH_USER']); 
} 
else {
   header("Location: http://website.com/failed_login");
} 
?>