Re: Re: Vanity URL Rewrites Best Practices?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Oct 6, 2011 at 3:00 PM, Nick Tkach <ntkach@xxxxxxxxx> wrote:
> Just to answer my own question, in case it helps someone else down the
> road, what I was missing was that inside the curly braces you need to
> dereference the variable with % rather than $.  So the right version
> of what I posted above is:
>
>  RewriteMap vanmap txt:/tmp/map.txt
>
>  RewriteCond %{REQUEST_URI} ^/mmh/
>  RewriteCond %{QUERY_STRING} \%2F(\w+)\.xml$
>
>  RewriteRule .* /mmh/${vanmap:%1}? [L,NC,R=302]
>

Since this is for posterity, I have to say 'No!'.

In both the RewriteRule and the RewriteCond, %N refers to back
references in the last matched RewriteCond, and $N refers to back
references in the RewriteRule. It doesn't matter one jot that it is
'inside the curly braces', it matters where the data comes from.

This is mentioned in both the RewriteCond and the RewriteRule documentation:

http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html#rewritecond
http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html#rewriterule

Cheers

Tom

---------------------------------------------------------------------
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@xxxxxxxxxxxxxxxx
   "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx




[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux