View Full Version : Dynamic Redirect Script

12-28-2005, 10:08 PM
Is coding a script that redirects your to the previous site's last access directory possible?

For instance...

www.somesite.com/directory/file.php?1233=k9234 - This is the website that you came from.

The redirect needs to point to www.somesite.com/directory/ only.

Any help would be appreciated as I'm not very experienced in coding php. I am very much interested in learning, that's why I'm here.

12-29-2005, 12:31 AM
$_SERVER['HTTP_REFERER'] does not always work (read: doesn't work most of the time).
If previous location was from your site then you'd set another variable which will act as a referer.
For example: http://www.somesite.com/directory/file.php?a=111&refer=directory
The script will look for 'refer' variable and will redirect the user back to 'directory'