Reputation: 2500
How do I redirect users and be sure that the HTTP_REFERER does not transfer to the next page after reaching a page called redirect.php.
The program flow is as follows:
1) On page at http://example.com/index.php (contains a link to redirect.php)
2) User click on the link to redirect.php and it sends the header('Location: http://otherlocation.com/index.php');
3) I need to prevent otherlocation.com from seeing the HTTP_REFERER from http://example.com/index.php
I have tried:
header('Location:redirect.php');
This does not work as HTTP_REFERER is populated with the value from the first page (http://example.com/index.php).
Upvotes: 2
Views: 298
Reputation: 5207
Fill up HTTP_REFERER depending by browser, not server-side
You may try redirect user by
<meta http-equiv="refresh" content="2;url=http://otherlocation.com/index.php" />
<script>document.location = 'http://otherlocation.com/index.php';</script>
browser not fill up HTTP_REFERER at this moment (IMHO)
At firefox this not work :(
Upvotes: 2
Reputation: 25745
to redirect using PHP send a header request to the browser. try this.
header('Location:redirect.php',true,302);
exit;
The above code will set the HTTP_REFERRER
trace to current page. hence deleting the trace from previous page.
Upvotes: 0
Reputation: 485
You can use
header("Location:redirect.php");
or if you want some delay or countdown, you can use.
// 5 is the seconds of the delay to go to the page you've entered.
header("refresh: 5; redirect.php";
Upvotes: 0