Link to home
Start Free TrialLog in
Avatar of manchung
manchung

asked on

How to redirect a page without losing HTTP_REFERER

How can I redirect a web-browser from
one HTML page to another HTML page
without losing the environment
variable HTTP_REFERER?

Usually, if I use
<meta http-equiv=REFRESH CONTENT="1; ...">,
the environment variable HTTP_REFERER
will be gone when it gets to the second
page. So, it's not an option.

What I mean by "without losing HTTP_REFERER"
is this:

Suppose aaa.html has a pointer to bbb.html .
Now, I want those people trying to access
bbb.html to be automatically forwarded to
ccc.shtml with HTTP_REFERER still being
"aaa.html".


   That is to say,

aaa.html --1--> bbb.html ---2---> ccc.shtml

1: a link from aaa.html to bbb.html
when people follow the link,
HTTP_REFERER = aaa.html

2. automatic redirect from bbb.html
to ccc.shtml with HTTP_REFERER
still being aaa.html so I can capture
it using server side include.

 Can anybody please help me?

 Thanks in advance.
Avatar of manchung
manchung

ASKER

Edited text of question
My guess would be that you can't do it. That would defeat the whole purpose of HTTP-REFERRER, wouldn't it? It would be an effective cloaking device for websites and some sites that block links from certain other sites could easily be tricked.

My tip (not new): make your page bbb.html include the referrer-property as part of the link to ccc.shtml. Seeing you use shtml, I assume that you use or have access to CGI. When you generate bbb.html, encode the referrer in some way if you like (if it is not supposed to be easily changeable) and make your links point to ccc.shtml?r=rerrefer. You still can't include it with a server-side include, but ccc has access to it using either JavaScript or a CGI script that evaluates the parameters and writes it into the code for the page.

I am not saying that it is definitely not possible and leave the question open for anybody who knows a nice trick. If such a trick does not exist, my suggestion would probably be your best bet.

Unnecessary to mention that there are a dozen workarounds for your problem by adjusting the code in ccc the react to both aaa and bbb as referrers...
ASKER CERTIFIED SOLUTION
Avatar of kollegov
kollegov

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hmmmm, maybe, I was being unclear about what I really needed.

aaa.html is some webpage out there having a hyper-link to my page bbb.html. "aaa.html" is not a webpage of my own. So, I don't have  any control over it whatsoever.

My original homepage is bbb.html, which is only a plain HTML document. No java/javascript. No server side include either because my web server only executes server-side include code in documents ending with "shtml". That was why I wanted to make another webpage (ccc.html) with almost the same content as that of bbb.html except that it would carry some server-side include code to capture the HTTP_REFERRER (which is aaa.html) because I wanted to know who pointed to my webpage bbb.html.

I thought of adding some javascript in bbb.html. But, it only works when people use a javascript-enabled browser. It doesn't work under all circumstances.

Besides, I also tried to turn bbb.html into a symbolic link to ccc.shtml on UNIX. But, the server-side include still didn't get executed.

Are there any other ways to figure out who points to my webpage bbb.html?

Thanks to all who have contributed their ideas to help me solve the problem.