URGENT: Bit of help on routes would be appriciated

Is it possible to have multiple routes going to one page for example:

/products/:cat/:cat_name?/
This would filter the DB on ‘cat’

but then I would also like to do this on the same page
/products/:cat/:cat_name?/:subcat/
Which would filter the DB on ‘cat’ and ‘subcat’ on the same page.

Is this possible or is there a better way of doing this ?

I would do search parameters in the querystring and not in the url path. Routing is good for dynamic detail pages and for SEO. Passing optional parameters like for a search or filter I would just put in the querystring.

I thought @Patrick that was what the /:cat/ was doing is passing it in the url in the background as

http://localhost:8100/api/Products/view_category?cat=BM

Which is working fine for one query, however if I put another in there then it does not work.
for example on Button 1 there would be a ‘cat’ on button 2 there would be a ‘cat’ & ‘subcat’ this is what I need to do.

Why not make both parameters optional i.e.
/products/:cat/:cat_name?/:subcat?/

Then use conditions to sort out the logic dependent on each query value having content

@Hyperbytes Hey Brian, I ended up doing it a slightly different way than I was originally planning.
I’ve got the router working finally.
However rather than doing a query I’ve just set it to a select menu I have in there for Subcat, which is better as you can also then just click to alter the result for other things.
I’ll add a slug into it as well for SEO purpose. :slight_smile:

here’s a link to have a look if you want.
http://159.223.90.134/Product-Category/CB/cables/Network%20Cables/