I would like to use following RESTful URL for a web site I’m working on.
http://mysite.com/Products/category=bags&colours=black
can anyone please tell me how to achieve this with .htaccess?
Oscar
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Here’s an .htaccess to capture anything except when files or directories conflict and it routes to /index.php:
With that we can use /index.php as our request router. In PHP we simply get the request something like so:
That said, your URL pattern is non-standard and I’d really recommend against it because proxies and browsers will URL encode the ampersand and equal signs. Let me suggest one of the following instead (and also to use lowercase as it helps with validation of the URL):
To see what will encode in the path of a URL just Google it and look at Google’s search URL.
Hope this helps.
-Mike