Product routes setup


#1

Hi all!
Can I edit structure of url my products?
can i remove “product” part from url like http://mySite/myShop/product/productName ?


#2

At the moment you can define routes using Flow Router, so you could define custom routes to the product there or by adding to the Reaction registry. The plan for the routing is to add a Routes collection + UI to allow for editing routes and redirecting existing routes.


#3

kadira:flow-router-ssr ?
this lib registry in ./server/register.js?
i change route: “/product/:handle/:variantId?” to route: “/:handle/:variantId?”,
after change any reaction,
url still with /product/ segment,
why?


#4

Two things… you can change as you did, but what about every other url that would be in the /:handle position? that’s a variable, so you’d have things like ‘dashboard/settings’ etc that might no longer work. I think you need some unique prefix to identify your product specific urls. Also when you change the urls, make sure take a look at the routes tables, - if you don’t see your updated routes you might need to reload/refresh -> the routing table is created on startup, and may not be refreshed.

But yes, the server/registry is the way to modify the urls, but you can use FlowRouter commands also to add routes. We use flow-router-ssr but the normal flow-router docs apply.


#5

i thought each product have unique handle,
what did you mean? for example?