c# - How to set up routing so that Index does show? -
so know google can penalize site if have same content on multiple urls... unfortunately, in mvc common can have example.com/
, example.com/home/
, example.com/home/index
, 3 urls take me same page... how make sure whenever index
in url, redirects same without index
, of course same thing home
perhaps this little library may useful you. library not convinient in case, should work.
var route = routes.maproute(name: "default", url: "{controller}/{action}/{id}", defaults: new { controller = "home", action = "index", id = urlparameter.optional }); routes.redirect(r => r.maproute("home_index", "/home/index")).to(route); routes.redirect(r => r.maproute("home", "/home")).to(route);
Comments
Post a Comment