我正在尝试创建SEO友好的URL。
当前URL:
http://www.example.com/Product/free-mobile-images/Mobile
预期的OUPUT:
http://www.example.com/Product/free-mobile-images/
我正在使用id
从数据库获取Moblie数据。
ActionMethod
public ActionResult Product(string seotext, string id)
{
return View();
}
rout.config
routes.MapRoute(
"Product",
"Product/{seotext}/{id}",
new { controller = "Home", action = "Product" });
我试图从路由值中删除Moblie:
RouteData.Values.Remove("id");
RouteData.Values.Remove("Mobile");
但我仍然在URL结束时获得/移动。
我可能知道我在做什么,任何帮助都会很棒。
为什么不创建一个文件夹结构来模仿所需的路径,然后调用文件index.aspx,它会具有相同的效果,但要简单得多。
eg文件夹称为product,然后在该文件夹中,称为free-mobile-images,然后在您的文件中称为index.aspx