Hi,
I’m using SS Razor plugin to serve pages.
I would like to use “Vanity URLs” (I’m not sure if this is the correct term).
So using a StackOverflow url as an example I want to include some text with the question title in the URL:
http://stackoverflow.com/questions/9699083/servicestack-vs-asp-net-web-api
What they seem to be doing is a 301 redirect to the full URL above if we use the URL without the http://stackoverflow.com/questions/9699083
Any suggestions on how to implement this? Are there any drawbacks?
Thanks in advance
Declare multiple routes for your service, 1 with the vanity url and 1 without. Then in your service just check that the Vanity path is populated, if not redirect by returning HttpResult.Redirect().
Carlos Mendes:
Thanks.
I use the UrlExtensions to generate links. In this scenario, with two different routes for the same DTO how would it work?
Try it and see, it should use the best matching route by default.
Carlos Mendes:
Thks!