これは私にとって長い間機能し、突然機能しなくなりました。同じフォルダー (ユーザー) に .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"); 
?>