ZachEdwards Posted January 19, 2008 Share Posted January 19, 2008 I am trying to use this code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>404 - Page Not Found</title> <style type="text/css"> <!-- .style1 {font-family: "Century Gothic"} --> </style></head> <body> <div align="center"> <p class="style1">Looks as if you have stumbled across a missing link.</p> <p class="style1"> <?PHP $referreromg = $websiteaddress.getenv("REQUEST_URI"); echo '<A HREF="'.$referreromg.'>Go Back to Last Page.</a>'; ?> </div> </body> </html> on a 404 page. It shows the current page's URL. I want it to show the URL of the last page visited. Let's say I go to: test.com/valid.html [valid link] Then I go to test.com/invalid.html [invalid link] I want it to say on the 404 page: test.com/valid.html -Zach Link to comment https://forums.phpfreaks.com/topic/86809-show-referrer/ Share on other sites More sharing options...
toplay Posted January 19, 2008 Share Posted January 19, 2008 Use $_SERVER['HTTP_REFERER'] but it's up to the browser to send, so it should not be 100% relied upon. See: http://us.php.net/manual/en/reserved.variables.php#reserved.variables.server Link to comment https://forums.phpfreaks.com/topic/86809-show-referrer/#findComment-443686 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.