Jump to content

URL Rewrite with multiple parameter


vbnullchar

Recommended Posts

hello.. how can i rewrite this urls with multiple parameters:

 

http://localhost/purchase/index.php?page=edititem&cat_id=1&item_id=2... etc

to

http://localhost/purchase/edititem/1/2

 

i have a exiting rewrite this works without url parameters :

RewriteRule ^([A-Za-z0-9-]+)/?$ index.php?page=$1 [QSA,L]

 

thanks,

Link to comment
https://forums.phpfreaks.com/topic/69876-url-rewrite-with-multiple-parameter/
Share on other sites

The only way I know of to have an unlimitted number of variables would be to capture them all into one string, then parse that string using php. eg;

 

RewriteRule ^(.*)$ index.php?parms=$1 [L]

 

Then in index.php you would get your entire url (eg; /purchase/edititem/1/2/n1/n2/n3/n4/n) within $_GET['parms']. From there you would need to parse the string yourself using php. This is something simular to what I use within my mvc framework.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.