[thelist] How to simply display referer url in html

Paul Waring paul at xk7.net
Sat Jul 7 03:30:12 CDT 2007


On Fri, Jul 06, 2007 at 10:29:35PM +0100, Mike Maughan wrote:
> I have been reviewing the domains I have registered (too many) and have
> decided to try to sell off some of the unwanteds, so I've used the
> "redirect" facility at my hosters (dreamhost) to point browsers to a landing
> page at my site forsale.bolleaux.com.
> 
> At the moment I have a noddy page there but I would like to start to improve
> it by at least being able to display the url that sent the browser to my
> page, so instead of saying "the domain you clicked on o get here is for
> sale" I'd like to say something like "domain.com is for sale", filling in
> domain.com from the referer field.

Something similar was asked last week to do with redirects and the
referer field. If your host is doing redirects properly, you will *not*
get the domain name in the referer field, you will instead get the URL
containing the link to get to the domain (you're not even guaranteed to
get that). The referer field is sent by the client, so you can't change
it by bouncing through a server-side redirect.

The easiest way to solve this is to have your domains redirect to
something like forsale.bolleaux.com?domain=$domain - so going to
www.example.com would take you to
forsale.bolleaux.com?domain=example.com. Then you take that query string
parameter and do whatever you want with it in the language of your
choosing.

Paul



More information about the thelist mailing list