Maintain HTTP Referer

apache, http-referer, redirect

Solution

`Redirect` won't preserve the referrer because the browser is sent a 301 and a new address to open. From the manual:

The Redirect directive maps an old URL into a new one by asking the client to refetch the resource at the new location.

mod_rewrite and (I think) Alias can rewrite directly (i.e. without causing a browser redirect) and will preserve the referrer. With mod_rewrite, you can even add the referer as a GET parameter to your request, if you want to.

Problem

I've setup some redirects on an Apache server. They look at bit like this: Redirect /Name/register /login.html My question is this... is there anyway to preserve the HTTP Referrer through this redirect? It would seem that by default, Apache discards the information. I would really like it if after the redirect was complete the referrer was say: http://the.orginalurl.com/Name/register Anyone if this is even possible? If not, thoughts on an alternative. Many thanks, Neil

Original source