I will be launching a new site soon. One section of the site contains products.
I am currently trying to decide between different URLS for the ASP.NET routing :
**Products: **
/products/1001
/products/sku/1001
/products/product/1001
/products/view/1001
**Categories: **
/products/category/cats
/products/category/clothing
/products/cats - this is pretty nasty
/products/clothing
I am primarily trying to decide which of the following I should adopt. I am currently doing the first.
routes.MapRoute(
"product-route-short",
"products/{sku}",
new { controller = "Products", action = "ViewProduct", sku = "1001"}
);
or
routes.MapRoute(
"product-route-short",
"products/sku/{sku}",
new { controller = "Products", action = "ViewProduct", sku = "1001"}
);
or one of the following
* call the action 'sku' , 'details' , 'item'
* use an [ActionName] attribute and leave the action method name as 'ViewProduct'
I really like the simplicity of /products/1001
so the user can see it and change it - but there is quickly a danger of it conflicting with other actions if I'm not careful. I also have to be sure to use 'product-route-short'
when creating my URLS which is a very minor pain.
What does anyone think? What have you found a best practice to be? This example is pretty simple, but I want to be consistent across the site of course and don't want to have to retrofit everything once Google has already indexed everything for me.
If there are any especially good podcasts or articles on the subject (general or specific to ASP.NET) I'd appreciate links to them. I found a good podcast where one thing they specifically said was that 'this podcast is NOT about how to create good REST links'