httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject Re: [users@httpd] OT: Tracking clients as they leave site -- means and options
Date Wed, 08 Jan 2003 12:57:35 GMT
On Wed, Jan 08, 2003 at 12:12:58AM -0600, Gary Turner wrote:
> An alternative would be to pass the target (not in the HTML sense) as an
> argument to a common script.  Now the script would need to parse target,
> referer, date, etc., and save to a log/database.

I don't understand why it has to be so complicated.

Surely the script won't need to save the log information?  You'll

 <a href="/cgi-bin/go.cgi?target=some_unique_hashed_id">go here</a>.

Which will appear in your standard log file as something like:

 "GET /cgi-bin/go.cgi?target=some_unique_hashed_id HTTP/1.0"

with referrer, date and everything.

Your script then just looks up the hashed_id in a database (or perhaps
the target is encoded directly, and can be parsed out directly), and
issues the Location: response.  It should work fine.

In fact, I just tried it.  Go to:

...and it'll redirect you to  The script looks like this:

#!/usr/bin/env ruby

print "Location: " + ENV['QUERY_STRING'] + "\r\n"
print "\r\n"

Error handling is left as an exercise for the reader.  The log file looks like this: - - [08/Jan/2003:12:54:44 +0000] "GET /cgi-bin/go.rb?
HTTP/1.1" 302 323 "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.0.3705)"

I'll disable the script shortly, so it might not be there when you try it.


The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:> for more info.
To unsubscribe, e-mail:
   "   from the digest:
For additional commands, e-mail:

View raw message