大众301重定向ASP.NET中,包括需要重定向到一个不同的地方根据不同的查询字符串参数页 [英] Mass 301 redirects in ASP.NET, including pages that need to redirect to a different place depending on the query string parameters

查看:142
本文介绍了大众301重定向ASP.NET中,包括需要重定向到一个不同的地方根据不同的查询字符串参数页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有我们的网站的几个页面使用旧的非搜索引擎友好的URLS索引,如 HTTP :?//www.domain.com/DocumentDetails.aspx ID = 555 。最近,我们实现了一个使用存储在数据库中蛞蝓和查找蛞蝓使用路由到您转发到正确的页面,例如路由:的 http://www.domain.com/Documents/Title-of-the-Document

We have several pages of our site indexed using old non-SEO friendly URLS such as http://www.domain.com/DocumentDetails.aspx?id=555. Recently we implemented routing that uses slugs stored in the database and looks up the slug to forward you to the right page using routing, for example: http://www.domain.com/Documents/Title-of-the-Document

这是一切都很好但是我们有一个很难找到建立我们的301永久重定向目前由谷歌索引的所有链接的最佳方式。

This is all well and good however we are having a hard time finding the best way to set up our 301 permanent redirects for all the links currently indexed by Google.

有没有办法有1存储旧的URL和新的URL集中的地方,并让它做301重定向时自动找到一个条目,也可治疗不同的查询字符串参数不同的项目?我们使用的是IIS6和Server 2003。

Is there a way to have 1 centralized place to store old URL and new URL, and have it do the 301 redirect automatically when it finds an entry, and also treat different query string parameters as different entries? We are using IIS6 and Server 2003.

谢谢!

推荐答案

添加 CustomRouteHandler 以你的旧页面,可以做301到新网址:

Add a CustomRouteHandler for your old page that can do the 301 to your new URL:

//look up new url and do the 301
Response.Status = "301 Moved Permanently";
Response.AddHeader("Location","http://www.example.com/");

这篇关于大众301重定向ASP.NET中,包括需要重定向到一个不同的地方根据不同的查询字符串参数页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆