Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个可以处理多个 TLD 的网站。我想在用户被重定向到正确的域之前保存用户来自哪里的初始推荐人。重定向之后,引用者显然被重写(并且它不会读取在另一个域上设置的 cookie 或会话)。
有没有一种方法可以在重定向时将它传递给 GET 变量,然后在用户登陆域后覆盖它,这样如果他们注册到该站点就可以保存它。
我使用 php。
<?php // on the first domain header("Location: http://newdomain.com/?referrer=".urlencode($_SERVER['HTTP_REFERRER'])); die();
然后在正确的域上,您可以使用$_GET['referrer'].
$_GET['referrer']
如果您使用 HTTP 301 重定向,那么大多数(?)浏览器会将原始引荐来源信息发送到新目的地。