I have tried to implement slug url like this
www.abcd.com/xyz/er/productname
where "/xyx/er" is area and it's working, But when ever I am trying to go to another page like
www.abcd.com/xyz/er/Login
then it's just keep redirecting.
Here is my code for RegisterArea:
context.MapRoute(
name: "product",
url: "xyz/er/{*slug}",
defaults: new { controller = "er", action = "Index", slug = UrlParameter.Optional }
);
context.MapRoute(
"default",
"xyz/{controller}/{action}/{id}",
new { controller="er", action = "Index", id = UrlParameter.Optional }
);
and my controller code is:
public ActionResult Index(string slug=null)
{
if (slug != null && (slug != "Index" && slug != "index"))
{
//it will show the product
}
else
{
//redirect to another page
}
}