Jump to content

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.