.htaccess r=301 与 r=302
我正在我的 .htaccess 中为移动设备或坏页面等创建规则...
我正在使用这些规则:
rewriterules badpage /goodpage.html [r=302]
rewriterules iphone /iphone.html [r=301]
哪一个更好用?
我知道是暂时的和永久的,但是当暂时的变成永久的时,我的理解是两者都做同样的事情,所以最终的结果是相同的。
我想知道从浏览器和机器人的角度来看 301 和 302 之间有什么区别。
I am creating rules in my .htaccess for mobile, or bad pages etc...
I am using these rules:
rewriterules badpage /goodpage.html [r=302]
rewriterules iphone /iphone.html [r=301]
Which one is better to use?
I know is temporary and permanent, but when a temporary becomes permanent, my understanding is both do the same thing so same result at the end.
I would like to know what is the difference between the 301 and 302 on a browser and bots perspective.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
永久移动网站或网页时,最佳做法是使用 301 重定向。在这种情况下 302 似乎不正确。通过说“临时移动”,302 告诉搜索引擎保留旧域或页面的索引,但希望它们对新位置建立索引。人们使用 302 重定向来规避 Google 老化延迟。此解决方法可能在某些时候有效,但这不是当前的最佳实践。
参考:301 与 302 重定向
When permanently moving a web site, or a web page, best practice is to use a 301 redirect. 302s in this situation seem incorrect. By saying "temporary move" a 302 tells search engines to keep the old domain or page indexed, but it would be desireable for them to index the new location. People use 302 redirects in an effort to circumvent the Google aging delay. This workaround might have worked at some point, but it is not a current best practice.
Ref: 301 Vs 302 Redirects