Rather than an item named product
, create an item named products
that represents the entire collection, and then create a child item named *
to represent any individual product.
Wildcard items will be resolved with any path that doesn't match an existing item, so if your tree is:
/products
/products/example
/products/*
A request to http://example.com/products/example
will get you the /products/example
item, whereas a request to http://example.com/products/123
will get you the /products/*
item.
With your items named appropriately, it then makes sense that a request to http://example.com/products
would return some sort of collection view of all products, whereas http://example.com/products/123
would return the details for the product with an ID of 123
.
It will be up to you to parse the current URL for the ID of the product. Additionally, you will need to manually handle 404 errors, as Sitecore can't tell whether or not a given path is meant to exist.
As far as assigning renderings, presentation details set on the *
item will be applied to the given request.