You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Jack Nerad <jn...@cimedia.com> on 2002/04/24 20:10:58 UTC

Redirect from site1 to site2 getting site1 as referrer (was Re: mod_rewrite)

On Wednesday 24 April 2002 11:06, you wrote:
> On Wed, 24 Apr 2002, Martin Marusinec wrote:
> > I want to use redirection on my server, with mod_rewrite, but I
> > want it, while rewriting the URI, to update also HTTP_REFERER
> > field, as I found, the referer is still the same.
> >
> > Is it possible to tell mode_rewrite to update the field, or to set
> > it by some configuration directive in httpd.conf file?
>
> No, because the Referer is controlled by the browser, not the server.
>
> Joshua.
>
>

Would 

Something like

[site1]

RewriteEngine On
RewriteRule ^(.*) http://www.site2.com/redirectedfromsite1 [R]

[site2]
RewriteEngine On
RewriteRule ^(.*)/redirectedfromsite1 $1 [E=HTTP_REFERER:site1]

work? 

--
Jack Nerad


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: Redirect from site1 to site2 getting site1 as referrer (was Re: mod_rewrite)

Posted by Jack Nerad <jn...@cimedia.com>.
On Wednesday 24 April 2002 14:27, Joshua Slive wrote:
> On Wed, 24 Apr 2002, Jack Nerad wrote:
> > Would
> >
> > Something like
> >
> > [site1]
> > RewriteEngine On
> > RewriteRule ^(.*) http://www.site2.com/redirectedfromsite1 [R]
> >
> > [site2]
> > RewriteEngine On
> > RewriteRule ^(.*)/redirectedfromsite1 $1 [E=HTTP_REFERER:site1]
> >
> > work?
>
> No, for two reasons:
>
> 1. You can't change the "built-in" environment variables that way.
> You could, of course, set a variable like NEW_HTTP_REFERER.
>

I must not understand the distinction between the environment variables 
you are speaking of.  When I tried that and put <!--#echo 
var="HTTP_REFERER" --> it did echo what I put in the rewrite rule.  The 
same variable also printed the correct information when I made a link 
to it from another page.  Could you elaborate?


> 2. Even if you did that, it wouldn't help the problem because anyone
> saving that link would also get through without going through the
> first site.  That defeats the intended restriction.
>

Good point.  There might be a way to make that new url value rotate or 
be generated randomly per paired request.  Security through environment 
variables isn't much in the way of security, though. 

> Joshua.

--
Jack

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: Redirect from site1 to site2 getting site1 as referrer (was Re: mod_rewrite)

Posted by Joshua Slive <jo...@slive.ca>.
On Wed, 24 Apr 2002, Jack Nerad wrote:
> Would
>
> Something like
>
> [site1]
> RewriteEngine On
> RewriteRule ^(.*) http://www.site2.com/redirectedfromsite1 [R]
>
> [site2]
> RewriteEngine On
> RewriteRule ^(.*)/redirectedfromsite1 $1 [E=HTTP_REFERER:site1]
>
> work?

No, for two reasons:

1. You can't change the "built-in" environment variables that way.
You could, of course, set a variable like NEW_HTTP_REFERER.

2. Even if you did that, it wouldn't help the problem because anyone
saving that link would also get through without going through the
first site.  That defeats the intended restriction.

Joshua.


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org