in reply to SSI pain...

You are right, HTTP_REFERER is not set, but instead you can use DOCUMENT_URI.

Ciao, Valerio