如何停止搜索引擎对维护页面建立索引
我需要为我正在运行的网站设置一个维护页面,例如,当我执行网站维护(计划停机时间)时或者如果确实出现问题并且我需要建立一个保留页面时显示。
我需要做些什么特别的事情来确保搜索引擎爬虫不会将其编入索引并认为这是我的网站。 或者我应该执行 404、添加临时 robots.txt 文件或其他内容? 我基本上不希望他们将其索引为我的网站,但我也不希望他们认为我的网站已经死了并且不再回来。
编辑:这是我在 Apache 中所做的:ErrorDocument 503 /.server-maintenance.html RewriteEngine On RewriteRule !^.server-maintenance.html /server-maintenance Redirect 503 /server-maintenancestrong文字
I need to setup a maintenance page for a website I'm running, e.g. for display when I'm performing site maintenance (scheduled downtime) or if something really breaks and I need to put up a holding page.
Is there anything special I need to do to ensure that search engine crawlers don't index it and think that it's my site. Or should I do a 404, add a temporary robots.txt file or something? I basically don't want them to index it as my site, but I also don't want them to think my site is dead and not come back.
Edit: Here's what I did in Apache: ErrorDocument 503 /.server-maintenance.html RewriteEngine On RewriteRule !^.server-maintenance.html /server-maintenance Redirect 503 /server-maintenancestrong text
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
您应该发送
503 Service Unavailable
HTTP 状态代码,而不是404
。 将此与Retry-After
标头结合使用,告诉机器人何时返回。You should send a
503 Service Unavailable
HTTP status code, and not a404
. Use this in conjunction with aRetry-After
header to tell the robots when to come back.您可以使用 robots.txt
http://www.robotstxt.org/
此外,Google 还有一个验证器在他们的网站管理员工具中。
https://www.google.com/webmasters/tools/
You may use a robots.txt
http://www.robotstxt.org/
Also, google has a validator in their webmasters tools.
https://www.google.com/webmasters/tools/
返回
503 Service Unavailable
告诉 Google 机器人稍后再回来。 Google 支持页面介绍了 HTTP 错误代码以及如何处理他们被他们解释。您还可以使用 Retry-After 响应标头来建议重新检查站点可用性的最短时间。
Returning
503 Service Unavailable
tells Google bots to come back later. There's a Google support page describing the HTTP error codes and how they are interpreted by them.You can also use Retry-After response header to suggest the minimum time after which your site is re-checked for availability.
另一种方法是不从您网站(或任何其他网站)上的任何其他页面链接维护页面。
Another approach would be to not link the maintenance page from any other page on your website (or any other website).