2012-05-17 72 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";