Mailing List Archive

RewriteCond not evaluated for backhanded pages?
Ok, I'm confused here. I'm trying to use mod_rewrite to migrate an old
domain name to a new one... so I have this:

RewriteCond %{HTTP_HOST} abc.defg.com
RewriteRule ^/(.*) http://new.hostname.com/$1 [R,L]

This works for all pages not backhanded. Anything that is backhanded
gets shown to mod_rewrite as a 'subreq', and no RewriteConds seem to be
evaluated (other rewrite rules are eval'd).

We currently use a setup like so:

<Location /js.php>
AllowOverride None
Options None
Order allow,deny
Allow from all
Backhand byAge 6
BackhandFromSO libexec/byHostname.so byHostname (js)
Backhand byRandom
Backhand byLogWindow
Backhand byLoad
</Location>

So requests for x.php never hit the RewriteCond. I get entries like this
in the rewrite log (RewriteLogLevel is 5):

x.x.x.x - - [26/Mar/2004:13:06:50 -0800]
[lhh.careercast.com/sid#810eb34][rid#8120414/subreq] (2) init rewrite
engine with requested uri /js.php
x.x.x.x - - [26/Mar/2004:13:06:50 -0800]
[lhh.careercast.com/sid#810eb34][rid#8120414/subreq] (1) pass through
/js.php

Is there a reason for this? Am I crazy? We have found a workaround, but
it would be nice to have this ability.
RewriteCond not evaluated for backhanded pages? [ In reply to ]
Clint Byrum wrote:

>Ok, I'm confused here. I'm trying to use mod_rewrite to migrate an old
>domain name to a new one... so I have this:
>
>RewriteCond %{HTTP_HOST} abc.defg.com
>RewriteRule ^/(.*) http://new.hostname.com/$1 [R,L]
>
>This works for all pages not backhanded. Anything that is backhanded
>gets shown to mod_rewrite as a 'subreq', and no RewriteConds seem to be
>evaluated (other rewrite rules are eval'd).
>
>We currently use a setup like so:
>
><Location /js.php>
> AllowOverride None
> Options None
> Order allow,deny
> Allow from all
> Backhand byAge 6
> BackhandFromSO libexec/byHostname.so byHostname (js)
> Backhand byRandom
> Backhand byLogWindow
> Backhand byLoad
></Location>
>
>So requests for x.php never hit the RewriteCond. I get entries like this
>in the rewrite log (RewriteLogLevel is 5):
>
>x.x.x.x - - [26/Mar/2004:13:06:50 -0800]
>[lhh.careercast.com/sid#810eb34][rid#8120414/subreq] (2) init rewrite
>engine with requested uri /js.php
>x.x.x.x - - [26/Mar/2004:13:06:50 -0800]
>[lhh.careercast.com/sid#810eb34][rid#8120414/subreq] (1) pass through
>/js.php
>
>Is there a reason for this? Am I crazy? We have found a workaround, but
>it would be nice to have this ability.
>
>
There is a reason for this. Though I could be convinced that it is
invalid is someone can show me a sound alternative :-) mod_backhand
hooks Apache at the post_read_request phase so that is can get the
completely virgin URL. It was important to do this as other modules
play evil tricks on r->uri (like mod_proxy).

The way we did this is how you did it... We also used virtual hosts for
the specific situation you described.

<VirtalHost _default_:80>
all your conf
</VirtualHost>

<VirtualHost abc.defg.com:80>
ServerName abc.defg.com
RewriteEngine On
RewriteRule ^/(.*) http://new.hostname.com/$1 [R,L]
</VirtualHost>


--
// Theo Schlossnagle
// Principal Engineer -- http://www.omniti.com/~jesus/
// Postal Engine -- http://www.postalengine.com/
// Ecelerity: fastest MTA on Earth