dynamic rewriting using both get and post

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
bertsmilsky
Forum Newbie
Posts: 13
Joined: Fri Jul 18, 2008 10:23 am

dynamic rewriting using both get and post

Post by bertsmilsky »

Hi there,

I want to be able to rewrite urls turning gets into search engine friendly urls. At the same time i have a contact form and i want to be able to use gets to produce error messages. For example:

In .htacces:
RewriteEngine On
Options +FollowSymlinks
RewriteRule ^([A-Za-z0-9-]+)/$ /?page_url=$1 [L]

So this URL works fine:
http://www.logfc0809wip.thewebmill.co.uk/contact/
echo $_GET['page_url']; /*Output is 'contact'*/

And so do these:
http://www.logfc0809wip.thewebmill.co.uk/contact/?msg=sent
http://www.logfc0809wip.thewebmill.co.uk/contact/?msg=senderror
echo $_GET['page_url']; /*Output is 'contact'*/
echo $_GET['msg']; /*Output is nothing*/

So $_GET['msg'] produces nothing. Is there a way to do this? Any suggestions?

Many thanks
filippo.toso
Forum Commoner
Posts: 30
Joined: Thu Aug 07, 2008 7:18 am
Location: Italy
Contact:

Re: dynamic rewriting using both get and post

Post by filippo.toso »

Add the QSA flag to your RewriteRule
Post Reply