重定向过多

编程入门 行业动态 更新时间:2024-10-21 07:26:52
本文介绍了重定向过多的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我找不到解决方案.基本上,我们使用的是虚荣网址系统,因此它是user.domain.可以访问所有文件,如user.domain/home.php等.清除cookie时,重定向将起作用,它会提示它们重新登录.但是,当我使用注销时,它仍然有效,但是当他们返回登录链接时,(user.domain在用户的登录页面上有一个登录表单供用户使用)将无法正常工作.我得到的错误是

I can't find the solution to this one. Basically we are using a vanity url system so its user.domain. All files are accessed like user.domain/home.php etc. When you clear cookies the redirects work, it prompts them to login again. But when i use logout, it still works but when they go back to the link to login, (user.domain, has a login form on the landing page for the user) it won't work. The error i get is

错误消息:

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.

所有会员页面的重定向代码:

Redirect Code for all member pages:

if(!isset($_SESSION['user_name'])) { header("Location: $_SERVER[HTTP_HOST]");} Note: The $_SERVER[HTTP_HOST] captures the user.domain value for redirect.

注销代码:

<?php session_start(); session_destroy(); header( 'Location: $_SERVER[HTTP_HOST]' ) ; ?>

解决此问题的唯一方法是用户清除cookie.

The only way for this issue to go away is if users clear their cookies.

更新:使用logout.php之后,我转到了user.domain/home.php成员页面之一,而不是将其重定向到user.domain进行登录,这给了我重定向错误.这可能是会话问题还是标题问题?

UPDATE: After using the logout.php i went to one of the member pages user.domain/home.php instead of it redirecting to user.domain for login it gave me the redirect error. Could this be an issue with the sessions or something with the headers?

我可以增强或添加哪些功能来解决此问题?我尝试了谷歌搜索,但没有发现任何特别的东西.我确实需要一些帮助来解决此问题.谢谢.

What can i enhance or add to fix this? I have tried Googling but haven't found anything particular to this. I really need some help in fixing this. Thanks.

这是我在Safari中收到的错误消息:

This is the error message i get in Safari:

Too many redirects occurred trying to open "user.domain/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.

推荐答案

浏览器阻止您对服务器进行大量请求.这很可能是由于header()将您发送到一个页面,然后又将您发送到同一页面(或具有相同header()的页面).

The browser is stopping you from hammering the server with a bunch of requests. This is most likely due to the header() sending you to a page which in turn sends you to the same page (or page with the same header()).

更多推荐

重定向过多

本文发布于:2023-10-31 16:18:23,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1546616.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:重定向

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!