2012-05-17 74 views
2

如何重定向用户并确保HTTP_REFERER在到达名为redirect.php的页面后不会转移到下一页。如何重定向到100%确定重定向后REFERRAL清理

程序流程如下:

1)在页在http://example.com/index.php(包含链接到redirect.php)

链接2)用户点击redirect.php并将其发送报头('Location:http://otherlocation.com/index.php');

3)我需要防止otherlocation.com从看到HTTP_REFERER从http://example.com/index.php

我曾尝试:

header('Location:redirect.php'); 

这并不为HTTP_REFERER工作中填充了从第一页的值( http://example.com/index.php)。

+0

问题的表述不清楚,你想要什么o?另外,你有什么尝试? – pomeh

+0

对不起,我的英文很难描述。我逐步添加一些关于我所做和需要的详细描述。 – abrahab

+0

@abrahab,更新我的答案检查出新的代码。 –

回答

2

填补了HTTP_REFERER根据由浏览器,而不是服务器端

您可以尝试通过

<meta http-equiv="refresh" content="2;url=http://otherlocation.com/index.php" /> 
<script>document.location = 'http://otherlocation.com/index.php';</script> 

浏览器重定向用户在这一刻被填满HTTP_REFERER(恕我直言)

在Firefox上这不工作:(

+0

是的,的方式,但将失去交流没有启用javascript:( – abrahab

+0

你可以发布\t Sergey

0

使用PHP进行重定向向浏览器发送标头请求。尝试这个。

header('Location:redirect.php',true,302); 
exit; 

上述代码将设置HTTP_REFERRER跟踪到当前页面。因此从上一页删除跟踪。

+0

似乎这种重定向发送页面的http_referral链接到redirect.php – abrahab

+0

更新现在检查代码。 –

0

您可以使用

header("Location:redirect.php"); 

,或者如果你想要一些延迟或倒计时,你可以使用。

// 5 is the seconds of the delay to go to the page you've entered. 

header("refresh: 5; redirect.php";