简体   繁体   English

php auth用户重定向标头位置

[英]php auth user redirect header location

This worked for me for a long time and suddenly it stopped working. 这对我有用了很长时间,突然间它停止了工作。 I have a .htaccess and .htpasswd in the same folder (users) and below is the index.php file 我在同一文件夹(用户)中有一个.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"); 
?>

Try this 尝试这个

<?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");
} 
?>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM