我将以 SO 站点为例。要转到问题列表,URL 是 www.stackoverflow.com/questions。在幕后,这会转到 Controller (名称未知)及其操作之一。假设这是 controller=home 和 action=questions。
如何防止用户键入 www.stackoverflow.com/home/questions 这会导致同一页面并降低页面排名作为搜索引擎优化而言。是否需要重定向来解决这个问题?是否需要一些特殊的路由规则来处理这种情况?还有别的吗?
谢谢
最佳答案
我假设 Controller 是 questions
并且 Action 是 index
,即路由处理程序定义的默认 Action 。因此,该页面没有替代路径。
关于asp.net-mvc - Asp.Net MVC 路由 : best way to have a single element in the URL?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/354927/