隐藏引用url参数


Hide referring url parameters

当我使用/landing.php?source=param调用脚本时,我希望脚本重定向到另一个域上的URL,但我不希望其他域上的人在他们的分析或服务器日志中看到source=param参数,我不介意他们能够看到/landing.php URL。

有解决方案的想法吗?

解决方案是先重定向到服务器上(可能是同一页面)不包含查询字符串的URL,然后将用户发送到您的非现场目的地。您可以使用$_SESSION或$_POST 在服务器上传递所需的参数/url

/landing.php?source=param>/redirect.php>www.offsite.com

在landing.php中,检查源变量,然后将其重定向到landing.php或其他没有GET变量的页面,例如:

if(!empty($_GET['source'])){
    // Save the source into a COOKIE / SESSION
    // Then redirect to another page to strip out the GET variable.
    redirect('landing.php');
}

然后在landing.php或另一个文件中,只需重定向到异地URL即可。如果你需要对它做任何其他事情,你将在COOKIE/SESSION中使用源代码。