PHP cross-origin retrieval of the previous page URL

Source: Internet
Author: User
For example, when you click the current page from www.baidu.com to jump to www.163.com, the variable $ _ SERVER [& #039; HTTP_REFERER & #039;] becomes the current page once the cross-origin is enabled, how can I break the URL of the previous page? For example, when you click the current page from www.baidu.com to jump to www.163.com, the variable $ _ SERVER ['HTTP _ referer'] becomes the current page once it is cross-origin. I want to get the previous page URL, how can this problem be solved?

Reply content:

For example, when you click the current page from www.baidu.com to jump to www.163.com, the variable $ _ SERVER ['HTTP _ referer'] becomes the current page once it is cross-origin. I want to get the previous page URL, how can this problem be solved?

$ _ SERVER ['HTTP _ referer'] will become invalid if you jump from the SSL authentication website link to your current page,
However, it is no problem to jump to $ _ SERVER ['HTTP _ referer'] To get the previous page URL between different SSL domain names.

$ _ SERVER ['HTTP _ referer'] several possible causes of missing values

  • Directly tap the URL in the browser
  • Hyperlink icon on windows Desktop
  • Bookmarks in the browser
  • Links in Word, Excel, and other content
  • Links in mail management software such as outlook
  • SSL Authentication Website jump
  • When automatic redirect is set on the meta page, the referer url cannot be obtained in example.com.

Please add.

On the page www.163.com print_r ($ _ SERVER), check if you want

$ _ SERVER ['HTTP _ referer'] # link to the URL of the previous page of the current page

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.