Re: [Semi-OT] mod_rewrite and $r->parsed_uri
[prev]
[thread]
[next]
[Date index for 2005/04/08]
Thomas Klausner wrote:
> Hi!
>
> Is it possible to somehow get to the URI as it looks like after beeing
> transformed by mod_rewrite?
don't you just want $r->uri?
>
> What I'm trying to do is:
>
> In a DB I have 'pseudo-files' with a column named 'path' and titles and
> bodies in several languages. (title_de, title_en, etc)
> Values for 'path' are eg: '/index.html', '/foo/bar.html'
>
> I have a RewriteRule like this:
> RewriteRule ^/(en|de)/(.*) /$2?lang=$1 [QSA,PT]
>
> And a handler that takes what is in $r->parsed_uri->path and does a DB
> lookup with the value.
I don't think anyone is supposed to (or traditionally does) mess with
$r->parsed_uri. it's usually $r->uri and $r->filename.
>
> The problem is that after mod_rewrite $r->parsed_uri->path returns
> '/de/index.html'.
>
> What am I missing?
I'm almost entirely sure what you're looking for is in $r->uri, especially
with the PT option. translation is a URI-to-filename mapping, so
essentially what your rule is doing is mucking with $r->uri and then letting
the next handler think $r->uri is what came from the browser. there's even
a comment in mod_rewrite to this effect.
if that doesn't work we can try another thought pattern :)
--Geoff
 |
 |
Re: [Semi-OT] mod_rewrite and $r->parsed_uri
Geoffrey Young 13:25 on 08 Apr 2005
|