0

I would really appreciate some help about .htaccess rewrite for query string for multiple pages.

The original page is /products.php?q=anything&type=cat

  • anything is dynamic value
  • cat is static value

And I would like to know how can I rewrite above url to /category/anything/page.html

I try to find a solution from several online sources but it seems after I place a rewrite rule, it return to products.php each time.

Thank you

user2971638
  • 477
  • 1
  • 4
  • 12

1 Answers1

1

This is assuming that you are always going to send the user to "page.html" and the only variable is "anything". If that's true, this should work:

RewriteRule ^category/(anything)/page.html /products.php?q=$1&type=cat

It will make the webserver send the query for /category/something/page.html to /products.php?q=something&type=cat

theglossy1
  • 543
  • 3
  • 13
  • Thank you But it doesn't work to get q to display a null value not q. In my words is set: category to replace a products.php ?q=anything-I-declare replace with /anything &type=cat replace with page.html – user2971638 Feb 06 '15 at 15:46