Forum Moderators: phranque

Message Too Old, No Replies

Question.

htaccess, mod_rewrite

         

Munzo

12:36 am on Jun 10, 2009 (gmt 0)

10+ Year Member



Hello,

I'm wondering if there is a solution to one of these problems I have...

I would like to take a url like this: domain.com/anotherdomain.com?p=1&g=2
and make it post everything after / to index.php and not use the get method.

OR...

I would like to take the url like this: domain.com/anotherdomain.com?p=1&g=2 and change the ? to Q and & to A.

Thanks!

jdMorgan

2:12 pm on Jun 10, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



This kind of change should be made in your page-generation script, as it is not something that can be achieved on the server side. The client does the POSTing and GETting, so the form processed by the client is what must be changed.

After that is done, then you could add mod_rewrite code to take incoming client requests for URLs ending with /Qp=abcAg=xyz and rewrite them to end with /?p=abc&g=xyz.

Jim

Munzo

3:11 pm on Jun 10, 2009 (gmt 0)

10+ Year Member



Erm... is there a way I can take the url like this: domain.com/anotherdomain.com?p=1&g=2 and change the ? to Q and & to A?

jdMorgan

4:14 pm on Jun 10, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Erm, No. Mod_rewrite cannot "change your URLs" as published on the Web. Since your pages "publish" your URLs, only your pages can publish different URLs.

Once those URLs are changed on you pages, mod_rewrite can "re-connect" them with the resources inside your server, such as changing Q back to "?" and A back to &, so that you can call your script and have it work.

And as stated, mod_rewrite cannot change POSTs to GETs or vice-versa, because it does not have access to the HTTP message-body.

See the tutorials in our Apache Forum Library if this is not clear.

Jim