Jump to content

Archived

This topic is now archived and is closed to further replies.

mbabli

PHP and Redirect

Recommended Posts

Hello everyone,
  If I redirect HTML page using the <META EQUIV-HTTP="Refresh"...etc> What are my options of retreiving the source URL before the redirection. Any help would be appreciated.

PS:  $_SERVER['REFERRER'; Is an empty string after redirecting.

Share this post


Link to post
Share on other sites
Before the redirection you can use $_SERVER['PHP_SELF'] OR $_SERVER['REQUEST_URI'] to get the source URL.

Then you can carry it over to the next script by attaching it to the redirect url as a GET ("?src=$_SERVER[REQUEST_URI]") or store it in $_SESSION.

Share this post


Link to post
Share on other sites
I think you want $_SERVER['HTTP_REFERER'].

Share this post


Link to post
Share on other sites
Thanks for the fast reply (Both):

  For solution 1: Unfortunately, the source page is HTML (Static), however, what I need is the source url (the info I need is in it). and
  altering Apache to hanle html as php is not the most feasible at the moment.

  For Solution 2: HTTP_REFERRER is an empty string if redirected because the referrer would be the browser itself.

  Any more suggestions? Thanks in advance

Share this post


Link to post
Share on other sites
You can't use $_SERVER['HTTP_REFERRER'] BEFORE you redirect, and then pass the variable to the redirected page?

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.