Jump to content


Getting http_referer from a webpage redirect

  • Please log in to reply
1 reply to this topic

#1 Arlo

  • New Members
  • Pip
  • Newbie
  • 1 posts

Posted 21 October 2006 - 06:52 PM

Hi all.

I have a website where most of my webpages automatically redirect the viewer to a PHP file on my site, and that PHP file needs to know which page redirected them there. But the problem is, $_SERVER['HTTP_REFERER'] and $_SERVER['REDIRECT_URL'] are only set when the user clicks a link to go to a different page, not when they're redirected. But surely there must be some way for pages to know which webpage redirected them there, no? Does anyone know how to do this?

#2 ksteuber

  • Members
  • PipPipPip
  • Advanced Member
  • 32 posts
  • LocationCalifornia, USA

Posted 23 October 2006 - 01:23 AM

you could change the redirect code to something like this:
<meta http-equiv="refresh" content="3;url=http://website.com/phppage.php?referrer=thisindividualpage.html">

and then add this to the php page
$referrer=$_GET[referrer]; //$referrer="thisindividualpage.html"

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users