301 重定向与 DNS 更改:终止 301 重定向并更新子域的 DNS 是否安全?

发布于 2024-07-15 05:06:42 字数 227 浏览 6 评论 0 原文

我有一个在子域上运行的站点,该子域已迁移到新服务器和新域名。 为了保留搜索积分,我知道 301 重定向是处理迁移转换的正确方法。 (营销部门所说的 301 重定向是我从未听说过的。)

从技术角度来看,我不明白您必须维持重定向多长时间。 有人可以解释一下吗? 为了保持重定向无限期地运行,这似乎会给服务器带来额外和不必要的负载。 在搜索引擎停止链接到以前的站点后,您最终会放弃它还是对其进行 DNS 更改?

I have a site running at a subdomain that has been migrated to a new server and new domain name. To preserve search credits I know a 301 redirect is the proper way to handle migrating the transition. (The marketing department speaks of 301 redirects like I've never heard of.)

From a technical standpoint, I don't understand how long you have to maintain a redirect. Can someone explain this? It seems like extra and unnecessary load on a server to keep a redirect running indefinitely. Do you eventually drop it or make it a DNS change after the search engines have stopped linking to the previous site?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

我爱人 2024-07-22 05:06:45

如果有人真正使用重定向,服务器上只会产生负载(而且很小),因此删除它并错过旧链接的一次点击是没有意义的。

There's only load on the server (and minuscule at that) if someone actually uses the redirect, so there's no sense removing it and missing out on even one hit from an old link.

妳是的陽光 2024-07-22 05:06:45

您可以将子域的 DNS 记录设为引用新域的 CNAME 记录; 我认为这样做没有任何害处,只要该网站仍然有效(某些网络应用程序依赖于了解它们访问的域名)。 但是,导航到子域的用户实际上会在浏览器的地址栏中看到子域,而不是新域,因此他们不会知道该网站已切换域。 因此,我不会使用 CNAME 记录来执行类似的“重定向”。 我会坚持使用 HTTP 301 重定向。

现在,我同意 ceejayoz 的观点,即服务器上的负载可以忽略不计,因此无需删除 301 重定向。 但是,如果您确实想知道多久可以删除它 - 例如,如果您想为不同的站点重用该子域 - 我会查看您服务器的访问日志,以跟踪子域随时间的点击次数,之后新网站上线。 (如果您安装了日志文件分析器,这会变得很容易)如果(周|月|年)过去了,您没有收到对该子域上任何内容的任何请求,则表明可能不再需要重定向。 显然,在子域上没有收到任何请求的情况下等待的时间越长,重定向被安全删除的可能性就越大。

You can make the DNS record for the subdomain a CNAME record referencing the new domain; I don't think there's any harm in doing so, as long as the site still works (some web applications depend on knowing the domain name they're accessed with). However, people who navigate to the subdomain will actually see the subdomain, not the new domain, in their browsers' address bars, so they won't know the site has switched domains. For that reason I would not use a CNAME record to do a "redirect" like that. I'd stick with the HTTP 301 redirect.

Now, I agree with ceejayoz that the load on the server is negligible, so there's no need to remove the 301 redirect. But if you did want to know how soon you can remove it - for instance if you wanted to reuse that subdomain for a different site - I would look at your server's access logs to track the number of hits on the subdomain over time, after the new site goes live. (If you have a logfile analyzer installed, it makes this easy) If a (week|month|year) passes without you getting any requests for anything on that subdomain, it's a sign that the redirect may not be needed anymore. Obviously, the longer you wait without getting any requests on the subdomain, the more likely it is that the redirect can be safely removed.

故人爱我别走 2024-07-22 05:06:44

301 是“永久移动”,因此理论上,书签中包含该链接的搜索引擎和浏览器应该切换到新的 URL。 但我不敢打赌每个人都会这么做。 因此,我同意 ceejayoz 的观点,谨慎的做法是让旧 URL 永远有效。

(还要记住,URL 不仅存储在搜索引擎中,您还可以在很多地方找到它们,甚至在纸上。这就是为什么 网址永远不会消亡。在发布网址之前请三思,之后您将永远无法回忆起它。)

301 is "Moved Permanently" so, in theory, search engines and browsers which have the link in their bookmarks should switch to the new URL. But I wouldn't bet that everyone does it. So, I agree with ceejayoz, it is prudent to keep the old URL working forever.

(Remember also that URL are not only stored in search engines, you can find them in many places, even on paper. That's why URLs never die. Think twice before publishing an URL, you'll never be able to recall it afterwards.)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文