How to do popup on new site for 301 redirected users?

冷暖自知 提交于 2019-12-24 02:45:16

问题


I have just migrated a site to a new domain (with new design) and am redirecting from the old site to the new with .htaccess and redirect 301. Since the new site is quite different, I'm concerned that users might be disoriented. Is there a way to have a popup on the new site that users get only if they have been redirected from the old site? Have been searching on this but keywords seem to lead only to stuff on popup redirects to another site.


回答1:


I can think of several ways to do it:

  • Redirect in the 301 to another page (www.blah.com/tour instead of www.blah.com) and there i would put the logic to show the popup

  • Redirect in the 301 to another page and there set a cookie and redirect to the original page. Then, add logic to the original page to show the popup if the cookie is present (and delete the cookie)

  • Check the referrer in the new site and if it matches the old one, show the popup




回答2:


Your problem boils down to detecting a request that has come via a 301 redirect - popups and usability are a separate (simpler?!) issue.

Unfortunately, detecting a 301 redirect is one of those inexact things that requires a mixture of techniques to get near to 100%. I say near, but never quite there - a bit like browser detection.

One option is to append a querystring (GET) parameter to the redirected URL, e.g.

www.example.com/LandingPage.html?isRedirected=true

You could also set the same info in a cookie (but won't work if cookies are disabled or cleared).

Another option is checking the Referrer header - but again, these may differ based on browser implementation and can be faked, although if someone's faking a redirect I don't think you need to worry about guiding them through your new design!



来源:https://stackoverflow.com/questions/11332270/how-to-do-popup-on-new-site-for-301-redirected-users

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!