Hi Thomas,

Thomas Bätzler wrote on 07.03.2005:

>>I need to translate a URL with a POST query string into a URL like
>>this:
>>
>>http://mysite.com/pages?id=1234 should become
>>http://mysite.com/pages/1234
>
>OTTOH:
>
>RewriteRule  ^/pages/([^/]+)/?$        /pages?id=$1 [QSA,NS,L]
>
>Or even easier, leave your URL like that and parse the PATH_INFO
>variable for your id.
>

Thanks. I already have this rule in place somewhere else, but I need to have 
something which works the other way around.

The rule you proposed (which I already use) does this:

http://mysite.com/pages/1234 -> http://mysite.com/pages?id=1234

But I need some rule to do this:

http://mysite.com/pages?id=1234 -> http://mysite.com/pages/1234

And since mod_rewrite does not parse the query string, I have a problem here.

The background is the following: I have a dynamic site, for which I can do this:

http://mysite.com/pages?id=1234 -> http://mysite.com/cgi-bin/show.pl?id=1234

using a rule similar to the one you proposed.

But I need to create a static version of the site (for distribution on CD), 
which should work without Perl scripts involved. So I cannot do

http://mysite.com/pages?id=1234 -> http://mysite.com/cgi-bin/redirect.pl?id=1234

and have redirect.pl redirect to the /html/1234.html file. This needs to be 
done by Apache.

Thanks,

Jan
-- 
Common sense is what tells you that the world is flat.

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to