[support] Cookie/Visit Tracking + Redirection

Metzler, David MetzlerD at evergreen.edu
Mon Mar 20 16:05:11 UTC 2006


I'd have to agree with Brew.  My experience on redirect problems, caused
me to write the following function for these kind of redirects.  It
illustrates exactly what brew was talking about using dirname, etc. 

Although technically this function should be modified to pull the http
or https from the protocol field. 

<?
function redirectFile($file)
{	
	header("location:http://" .$_SERVER['HTTP_HOST'] .
dirname($_SERVER['PHP_SELF']) . "/$file");
	return;
}
?> 

-----Original Message-----
From: support-bounces at drupal.org [mailto:support-bounces at drupal.org] On
Behalf Of lists at southernohio.net
Sent: Friday, March 17, 2006 7:57 PM
To: support at drupal.org
Subject: Re: [support] Cookie/Visit Tracking + Redirection

Hey, thanks for that note brew.  I'm not sure, that very well may be
true as it appears that Firefox is not having any issues.  I'm not sure
about IE yet, but it is with Safari that I'm struggling, even though, as
I said, it will work indefinitely after I've gone through the welcome
area that browsing session.

** If anyone does have any further experiences, or even better, if there
is a module that handles what I'm wanting to do more efficiently, please
advise.


Thanks!

-George





On Mar 17, 2006, at 2:07 AM, brew at theMode.com wrote:


George....

Well, I'm not going to debug your php (I have enough trouble finding my
own bugs!), but one thing I notice:

> 	header('Location:/welcome/index_main_site_entry.php');

seems suspect.

The php docs say:

header("Location: http://www.example.com/"); /* Redirect browser */

and further note:

Note:  HTTP/1.1 requires an absolute URI as argument to Location:
including the scheme, hostname and absolute path, but some clients
accept relative URIs. You can usually use $_SERVER['HTTP_HOST'],
$_SERVER['PHP_SELF']  and dirname() to make an absolute URI from a
relative one yourself:

Maybe it's only working some of the time, depending on the clients?

brew

--
[ Drupal support list | http://lists.drupal.org/ ]

--
[ Drupal support list | http://lists.drupal.org/ ]


More information about the support mailing list