0

The code below builds a url in this form.

http://mysite.com/browse/department/?pid=1 

and here is the rewrite cond and rule

RewriteCond %{QUERY_STRING} ^pid=([0-9]+) RewriteRule browse/(.*)/$ show_products.php?department=$1&pid=%1 

What i would like is to have 2 extra parameters the first is order buy and the second which isn't necessarily in the url which would be filter so the url would be like this

http://mysite.com/browse/department/?pid=1&order_by=a_z 

or with parameter filter

http://mysite.com/browse/department/?pid=1&order_by=a_z&filter=1 

How do I have my rewrite condition and my rewrite rule

1 Answer 1

1

You can add the existing query string to your request using the QSA flag (query string append). Since in your case you aren't actually changing the parameters you can do it a lot simpler:

RewriteRule browse/(.*)/$ show_products.php?department=$1 [QSA] 

This will rewrite

http://mysite.com/browse/department/?pid=1&order_by=a_z 

To

/show_products.php?department=department&pid=1&order_by=a_z 

And:

http://mysite.com/browse/department/?pid=1&order_by=a_z&filter=1 

To

/show_products.php?department=department&pid=1&order_by=a_z&filter=1 
0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.