How do I get the URL from the previous page used to connect to my site? Not the link

StackOverflow https://stackoverflow.com/questions/16641160

  •  30-05-2022
  •  | 
  •  

سؤال

I have tried this: $_SERVER['HTTP_REFERER']

The challenge is it only gets the link that the person clicked on to reach the next page and not the actual URL of the previous page.

It does not matter if it can be spoofed. Its not mission critical. I just need to track a percentage of the results accurately.

هل كانت مفيدة؟

المحلول

$this->session->set_userdata('url11',"http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]");

This it will work 100% use any variable in place url1 by which you can take it at place in application and write this thing in header of the view page in php tag.

نصائح أخرى

If you are trying to primarily track google search result click-throughs you should be using Google Analytics.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top