httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Lazy <lazy...@gmail.com>
Subject Re: [users@httpd] RewriteCond backreference in virtualhost context
Date Fri, 17 Aug 2012 10:40:47 GMT
2012/8/17 Igor Cicimov <icicimov@gmail.com>:
> Im really surprised your RewriteCond worked at all in any Apache version as
> it doesn't make sense to me. The $1 at the end has a meaning of variable
> which in your case has a value of ... what? Maybe if you tell us whar r you
> trying to do someone can help you.
>
> On Aug 17, 2012 8:01 PM, "Lazy" <lazy404@gmail.com> wrote:
>>
>> Hi All,
>>
>> a simple mod_rewrite rules
>>
>> RewriteEngine On
>>
>> RewriteCond /home/docroot/test/$1 -f
>> RewriteRule ^(.+).test$ /test/$1 [L]
>>
>> http://httpd.apache.org/docs/2.4/mod/mod_rewrite.html#rewritecond
>>
>> in apache 2.2.x this works in vhost and .htaccess context, in apache
>> 2.4.2 in vhost context $1 in RewriteCond is always empty
>>
>> Is this a bug or I'm missing something ?
>>

please read the docs,
"
RewriteRule backreferences: These are backreferences of the form $N (0
<= N <= 9). $1 to $9 provide access to the grouped parts (in
parentheses) of the pattern, from the RewriteRule which is subject to
the current set of RewriteCond conditions. $0 provides access to the
whole string matched by that pattern.
"
this rule redirects xxx.test to /test/xxx if /test/xxx is present

This can be used as an simple static cache.

Regards,

Michal Grzedzicki

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message