简体   繁体   English

网站大修后重定向旧网址

[英]Redirecting Old Urls After Web Site Overhaul

We have a website which we recently migrated to ASP.NET MVC. 我们有一个我们最近迁移到ASP.NET MVC的网站。 All of the URLs are now different from the original website. 现在,所有URL与原始网站都不同。 Google still has all of our old URLs, so if anyone finds us in a search, currently they will get a 404. Google仍然拥有我们所有的旧网址,因此,如果有人在搜索中找到我们,那么他们目前将获得404。

I have a catchall route that catches bad URLs, including all of the old ones. 我有一个全面的路由,可以捕获错误的URL,包括所有旧的URL。 In a perfect world I would like to do a 301 redirect to the home page for all urls matching this catchall route, and I do have code for this that works properly on my development machine. 在理想情况下,我想对所有与此匹配路径匹配的URL进行301重定向到主页,并且我有适合于我的开发计算机的代码。 However, I finally got someone at our ISP (Network Solutions) to tell me that they block 301 redirections (the web server returns a 404 instead). 但是,我终于在ISP(网络解决方案)找到了一个人,告诉我他们阻止了 301重定向(Web服务器返回了404)。

So I think my only remaining option is to just accept any bad URL, and point it to the home page. 因此,我认为我唯一剩下的选择就是只接受任何错误的URL,然后将其指向主页。

Here is my question: I know that the search engines (especially Google) are now penalizing duplicate content. 这是我的问题:我知道搜索引擎(尤其是Google)现在正在惩罚重复的内容。 If I just point all bad URLs to the home page, how much is this going to hurt us in the search rankings? 如果我仅将所有错误的URL指向主页,这会对我们的搜索排名造成多大的伤害? Do I have any other technical options? 我还有其他技术选择吗?

Honestly, I would suggest that you change ISP's. 老实说,我建议您更改ISP。 301's are an important tool in any webmaster's toolbox, and for them to block that will penalize you terribly. 301是任何网站站长工具箱中的重要工具,对他们而言,301阻止将给您带来极大的惩罚。 You could easily transfer your domain to another IP address, wait for the DNS propagation, and then do your rollout. 您可以轻松地将您的域转移到另一个IP地址,等待DNS传播,然后进行部署。

From Google's Webmaster tools: 通过Google网站站长工具:

Use a 301 Redirect to permanently redirect all pages on your old site to your new site. 使用301重定向将旧站点上的所有页面永久重定向到新站点。 This tells search engines and users that your site has permanently moved. 这告诉搜索引擎和用户您的网站已经永久移动。 We recommend that you move and redirect a section or directory first, and then test to make sure that your redirects are working correctly before moving all your content. 我们建议您先移动并重定向节或目录,然后再进行测试,以确保在移动所有内容之前重定向工作正常。

Don't do a single redirect directing all traffic from your old site to your new home page. 不要执行单个重定向,将所有流量从旧站点引导到新主页。 This will avoid 404 errors, but it's not a good user experience. 这样可以避免404错误,但这不是良好的用户体验。 It's more work, but a page-to-page redirect will help preserve your site's ranking in Google while providing a consistent and transparent experience for your users. 它的工作量更大,但是页面到页面的重定向将有助于保留您网站在Google中的排名,同时为用户提供一致和透明的体验。 If there won't be a 1:1 match between pages on your old site and your new site (recommended), try to make sure that every page on your old site is at least redirected to a new page with similar content. 如果旧站点和新站点上的页面之间不存在1:1匹配(推荐),请尝试确保将旧站点上的每个页面至少重定向到具有相似内容的新页面。

I'm sure that's much easier said then done, but I would never want an ISP that exerted that kind of filter against their clients. 我敢肯定,说起来容易做起来难,但是我永远都不想让ISP对客户使用这种过滤器。

Can you do a 302 redirect at least? 您至少可以进行302重定向吗? I do agree with what womp says though, what ISP would block 301 redirects? 我确实同意womp所说的话,什么ISP会阻止301重定向? Dump them. 转储它们。 ISPs are a dime a dozen. ISP一角钱。

I completely agree with womp. 我完全同意womp。 I cannot believe that an ISP would block 301's. 我无法相信ISP会阻止301。

I was so surprised that you can't do a 301 redirect on Network Solutions, because they're not exactly a two bit operation. 我很惊讶您无法在Network Solutions上执行301重定向,因为它们并不是两位操作。

Their own marketing material suggests that you can. 他们自己的营销材料建议您可以。 There's also a forum post by someone wanting to do a 301 redirect. 还有一个论坛帖子 ,有人希望进行301重定向。 Although they use a .htaccess, the reply from a Network Solutions tech support shows the user how to do a 301 redirect in ASP. 尽管他们使用.htaccess,但来自网络解决方案技术支持的回复显示了用户如何在ASP中执行301重定向。

If you opt to not change ISP then the simples solution is to display a page where you say that the page has been moved with a link to the new page link, then you add a 5 second delay that re-directs using a HTML meta tag: 如果您选择不更改ISP,则简单的解决方案是显示一个页面,您说该页面已被移动,并带有指向新页面链接的链接,那么您将添加5秒钟的延迟,该延迟将使用HTML元标记重定向:

<html>
<head>
<title>Page moved</title>
<meta http-equiv="refresh" content="5;url=http://example.com/newurl">
</head>
<body>
The page has been moved, click <a href="http://example.com/newurl">here</a> if you have not been re-directed to the new page within 5 seconds.
</body>
</html>

Alternatively you could use a URL rewriter, that way the old url "points" to the new page, there are basically two ways of doing this, the programmatically way is to create your own VirtualPathProvider , the second way is to use a URL Rewriter module like the IIS Url Rewrite Module . 另外,您也可以使用URL重写器,这样旧URL会“指向”新页面,基本上有两种方法,以编程方式是创建自己的VirtualPathProvider ,第二种方法是使用URL Rewriter模块就像IIS Url Rewrite Module一样

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM