I am a bit stuck on the design of my seo friendly urls for mvc….Take for example the following url: http://myapp/venues/resturants.aspx?location=central&orderBy=top-rated
With my mvc app i have mapped it as follows: http://myapp/venues/list/resturants/central/top-rated
{controller}/{action}/{category}/{location}/{order}
Now the only problem is that location and order are optional…so it should be possible to submit a request like: http://myapp/venues/list/resturants/top-rated . This proves to be a problem when the request hits the controller action, the location parameter has picked up ‘top-rated’, naturally.
Any suggestions? I’ am considering using explicit querystrings to handle more than one parameter but this is really my last option as i dont want to sacrifice SEO too much.
Has anyone eles run into such dilemmas? And how did you handle it?
Thanks in advance!
Assuming that the allowed values for location and order are unique (i.e. when they come in, you can tell them apart, or else if they only supply one, how are you going to know if it’s a location or an order?), then you could just take two parameters and work out what they are in the controller.
Route:
{controller}/{action}/{param1}/{param2}Controller action:
Not particularly elegant, but does let you have the URLs you want.