Forum Moderators: phranque

Message Too Old, No Replies

mod_rewrite

dynamic to dynamic rewriting

         

irldonalb

4:24 pm on Aug 30, 2004 (gmt 0)

10+ Year Member



Hi,

Is it possible to rewrite the arguments for php. This is what i have in mind.

RewriteRule ^mail.php?k=(.*)$ /handler.php?id=mail&k=$1 [L]
RewriteRule ^web.php?k=(.*)$ /handler.php?id=web&k=$1 [L]

Is sounds strange I know.
Thanks
Donal

jdMorgan

4:44 pm on Aug 30, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Yes, but a query string is not part of a URL -- see [webmasterworld.com...]

You will need to use RewriteCond %{QUERY_STRING} to access the query parameters and create back-references, and then use %1 - %9 in the RewriteRule to access those back-references.

Jim

irldonalb

5:43 pm on Aug 30, 2004 (gmt 0)

10+ Year Member



Thanks for that,

I tried that before (just had the settings wrong).

Just as a follow up because I’m still having trouble. I have a some variables with from a form. But after I use the mod_rewrite they come out blank. all my $_posts are blank.

form -> mod_rewrite -> response to form -> blank posts

Is this normal?

Thanks

jdMorgan

11:48 pm on Aug 30, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



We've discussed it several times before and reached no solid conclusion, but it seems that it is best not to try to rewrite URLs that you want to POST to.

Jim