Is there anyway to make all actions in a given controller to redirect to the server root?
For example, if I have a URL with controller Home and action terms I want that to the URL to become /terms
If I have another URL with controller Home and action privacy, then the URL should become /privacy.
I am able to do this by hard-coding 2 routes, but is there a way to automatically do this?
routes.MapRoute(
"Term",
"terms",
new { controller = "Home", action = "terms" }
);
routes.MapRoute(
"Privacy",
"privacy",
new { controller = "Home", action = "privacy" }
);
routes.MapRoute(
"ActionOnly",
"{action}",
new { controller = "Home" }
);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With