0

在我们的应用程序中,我们对所有页面进行 url 重写。例如,您有 . 最近我们把所有的 url 都改成了 /adults/about/ 或 /kids/about/ ……现在以前所有的 url 像“/about/”都会给 404。有没有办法添加 301 重定向并强制所有页面比如“/about/”去“/adults/about/”。我找到了一种方法,但我不确定它是一个好方法还是它对 SEO 有帮助。我所做的是为“/about/”添加一个 url 重写,例如“/adults/about/”,然后在 page_Load 检查 url 中是否没有“adults”或“kids”,然后重定向到“/adults /关于/”。大人小孩不是文件夹。它们只是帮助区分导航菜单。

抱歉,如果标题不清楚。

4

1 回答 1

0

Check the URL in Application_BeginRequest in your global.asax file. If the HttpContext.Current.Request.Url matches an old page, do an 301 redirect to the corresponding new page.

You can check this through Regular Expressions for example.

Here is explained how to do a proper 301 redirect.

于 2012-09-19T01:28:16.287 回答