我找不到解决方案。基本上我们使用的是虚荣url系统,所以它的user.domain.com。所有文件都像user.domain.com/home.php一样访问。当你清除cookies重定向的工作,它会提示他们再次登录。但是,当我使用注销,它仍然有效,但当他们回到登录链接(user.domain.com,在用户的着陆页上有一个登录表单)时,它将无法工作。我得到的错误是重定向过多
错误消息:
The page isn't redirecting properly
Firefox has detected that the server is redirecting the request for this address
in a way that will never complete.
This problem can sometimes be caused by disabling or refusing to accept
cookies.
重定向代码为所有会员页面:
if(!isset($_SESSION['user_name'])) { header("Location: http://$_SERVER[HTTP_HOST]");}
Note: The $_SERVER[HTTP_HOST] captures the user.domain.com value for redirect.
退出代码:
<?php
session_start();
session_destroy();
header('Location: $_SERVER[HTTP_HOST]') ;
?>
对这个问题的唯一办法离开是如果用户清除他们的cookies。
更新:使用logout.php后,我去了其中一个成员页user.domain.com/home.php而不是它重定向到user.domain.com登录它给了我重定向错误。这可能是会议或与标题有关的问题吗?
我可以加强或补充什么来解决这个问题?我试过谷歌搜索,但没有发现任何特别的东西。我确实需要一些帮助来解决这个问题。谢谢。
这是错误消息我在Safari中得到:
Too many redirects occurred trying to open “http://user.domain.com/home.php”.
This might occur if you open a page that is redirected to open another page which then is redirected to open the original page.
你在头部重定向之后做了一个die()吗? – 2011-01-28 17:24:57