I’m having problems rerouting my pages from website.com/controller/action to website.com/admin/controller/action.
I tried adding this to global.asax:
routes.MapRoute(
"Admin",
"admin/{controller}/{action}/{id}",
new { controller = "Admin", action = "Index", id = "UrlParameter.Optional" }
);
It worked but it also rewrote my other links adding the word “admin” in unintended places.
My problem is similar to this: ASP.NET MVC Routing, Need help creating route
Solved this using MVC areas. But the problem with areas is that you can not simply cut/paste your views and controllers to the new area – you have to recreate all of the controllers to make them work again. Hope this helps someone.