I am replacing an old ASP.NET web form application with a new MVC application. However, I have a problem with users who have old links to a specific page that I would like to automatically translate to the correct MVC route.
Old site: http://mysite.com/ticketsdetail.aspx?id=12345
New site: http://mysite.com/tickets/details/12345
Is there a way in MVC routing to catch the old url and translate it to the new one?
EDIT:
Ok, the web.config entry for this using rewrite of the IIS7 URL:
<rewrite> <rules> <rule name="Ticket page redirect" stopProcessing="true"> <match url="ticketsdetail.aspx$" /> <conditions> <add input="{QUERY_STRING}" pattern="id=(\d*)$" /> </conditions> <action type="Redirect" url="Calls/Tickets/{C:1}" appendQueryString="false" redirectType="Temporary" /> </rule> </rules> </rewrite>
source share