I have website that shows user submitted content in 30+ languages in front page,I am currently using paths like:
http://www.example.com?lang=en
or if it's not first page
http://www.example.com?lang=en&page=2
But that really isn't user or seo friendly. Is there a way in mvc to route these values to something like
http://www.example.com/en
and
http://www.example.com/en/2
without adding new action in-between like in this case lang:
http://www.example.com/lang/en/2
Update. Here is what I came up from Alexeis answer, in case anybody will need same thing:
In case of just language:
routes.MapRoute("MyLang", "{lang}", new { controller = "Home", action = "Index" },new { lang = @"\D{2}"});
In case you need language and optionally page:
routes.MapRoute("MyLang", "{lang}/{page}", new { controller = "Home", action = "Index", page = UrlParameter.Optional }, new { lang = @"\D{2}", page = @"\d+"});
It should not catch any other paths unless you have Actions with only 2 letters.