简体   繁体   English

将2个域重定向到登录页面,然后允许用户选择要访问的域

[英]Redirect 2 domains to a landing page, then allow user to select which domain to visit

I've got a client who has two sites... - they are almost the same with minor differences (logo being the most obvious). 我有一个拥有两个站点的客户...-它们几乎相同,只是存在细微差别(徽标是最明显的)。 Now he wants both domains to go to a landing page (that I've already set up and then from that landing page, the user can click to navigate to either site without being redirected again to the landing page. 现在,他希望两个域都转到登录页面(我已经设置好了,然后从该登录页面上,用户可以单击导航到任一站点,而无需再次重定向到登录页面。

I am kind of stumped on the best way to set that up. 我对设置它的最佳方法感到困惑。

Cookies/session and $_SERVER['HTTP_REFERER'] are your friends. Cookies / session和$_SERVER['HTTP_REFERER']是您的朋友。

Now you can use those as follow: 现在,您可以按以下方式使用它们:

Whenever the user navigates one of the 2 domains you need to check for a session/cookie (that you set) to make sure they have visited the landing page. 每当用户浏览两个域中的一个时,您都需要检查会话/ cookie(您设置的)以确保他们已经访问了登录页面。 If that session/cookie doesn't exist, you can check for $_SERVER['HTTP_REFERER'] if it matches the landing page. 如果该会话/ cookie不存在,则可以检查$_SERVER['HTTP_REFERER']是否与登录页面匹配。 If it matches, then set the session/cookie that the user has visited the landing page and any further navigation inside the domain will work since the session/cookie is now set. 如果匹配,则设置用户已访问登录页面的会话/ cookie,并且由于现在已设置会话/ cookie,因此域内的任何进一步导航都将起作用。 If $_SERVER['HTTP_REFERER'] doesn't match the landing page you redirect the user to the landing page and wait for them to come to one of the domains from that page in order to set the session/cookie. 如果$_SERVER['HTTP_REFERER']与登录页面不匹配,则将用户重定向到登录页面,并等待他们进入该页面中的某个域,以设置会话/ cookie。

I believe now you have all the info on what you need to do. 我相信现在您已经掌握了需要做的所有信息。 The implementation part is all yours. 实现部分全由您自己承担。 That's what you're paid for right? 那就是您所支付的权利吗?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM