使用 301 或 303 将 http 重定向到 https
Use 301 or 303 to redirect http to https
当从 http 重定向到 https 时,我不确定哪个最适合我的网站。
目前我正在使用 IIS 重写规则进行重定向。我读过的关于如何使用 301 或 303 的指南。在阅读了 301 和 303 之后,我仍然不确定哪个最好使用。
我的理解是它们在 http 和 https 之间的重定向方面非常相似。
有什么区别吗?它会以任何方式影响 SEO 吗?
来自规范:
301
The 301 (Moved Permanently) status code indicates that the target
resource has been assigned a new permanent URI and any future
references to this resource ought to use one of the enclosed URIs.
Clients with link-editing capabilities ought to automatically re-link
references to the effective request URI to one or more of the new
references sent by the server, where possible.
The server SHOULD generate a Location header field in the response
containing a preferred URI reference for the new permanent URI. The
user agent MAY use the Location field value for automatic
redirection. The server's response payload usually contains a short
hypertext note with a hyperlink to the new URI(s).
Note: For historical reasons, a user agent MAY change the request
method from POST to GET for the subsequent request. If this
behavior is undesired, the 307 (Temporary Redirect) status code
can be used instead.
A 301 response is cacheable by default; i.e., unless otherwise
indicated by the method definition or explicit cache controls
303
The 303 (See Other) status code indicates that the server is
redirecting the user agent to a different resource, as indicated by a
URI in the Location header field, which is intended to provide an
indirect response to the original request. A user agent can perform
a retrieval request targeting that URI (a GET or HEAD request if
using HTTP), which might also be redirected, and present the eventual
result as an answer to the original request. Note that the new URI
in the Location header field is not considered equivalent to the
effective request URI.
This status code is applicable to any HTTP method. It is primarily
used to allow the output of a POST action to redirect the user agent
to a selected resource, since doing so provides the information
corresponding to the POST response in a form that can be separately
identified, bookmarked, and cached, independent of the original
request.
A 303 response to a GET request indicates that the origin server
does not have a representation of the target resource that can be
transferred by the server over HTTP. However, the Location field
value refers to a resource that is descriptive of the target
resource, such that making a retrieval request on that other resource
might result in a representation that is useful to recipients without
implying that it represents the original target resource. Note that
answers to the questions of what can be represented, what
representations are adequate, and what might be a useful description
are outside the scope of HTTP.
Except for responses to a HEAD request, the representation of a 303
response ought to contain a short hypertext note with a hyperlink to
the same URI reference provided in the Location header field.
Google 说:
Redirect your users and search engines to the HTTPS page or resource with server-side 301 HTTP redirects.
我建议遵循 Google 的建议,而不是尝试实施 303 策略。
来源:https://support.google.com/webmasters/answer/6073543?hl=en
当您将 http 重定向到 https 时,本质上您希望从 SEO 角度保留 "link juice"。
如您所知,Google 考虑网站排名的后退次数link。
301 和 303 重定向的主要区别本质上是它是否传递 link 果汁。像您提到的那样存在技术差异,但从 SEO 的角度来看,301 是更好的选择。
这是一篇博客 post,它展示了 303 可能如何影响您网站的搜索引擎优化。
https://digitalreadymarketing.com/303-redirect-effect-seo/
如果您有兴趣了解有关重复内容的更多信息(http 和 https 是典型的重复内容问题),请查看此 post。
https://digitalreadymarketing.com/what-is-duplicate-content-how-to-find-solve-them/
当从 http 重定向到 https 时,我不确定哪个最适合我的网站。 目前我正在使用 IIS 重写规则进行重定向。我读过的关于如何使用 301 或 303 的指南。在阅读了 301 和 303 之后,我仍然不确定哪个最好使用。
我的理解是它们在 http 和 https 之间的重定向方面非常相似。
有什么区别吗?它会以任何方式影响 SEO 吗?
来自规范: 301
The 301 (Moved Permanently) status code indicates that the target
resource has been assigned a new permanent URI and any future
references to this resource ought to use one of the enclosed URIs.
Clients with link-editing capabilities ought to automatically re-link references to the effective request URI to one or more of the new
references sent by the server, where possible.The server SHOULD generate a Location header field in the response containing a preferred URI reference for the new permanent URI. The
user agent MAY use the Location field value for automatic
redirection. The server's response payload usually contains a short
hypertext note with a hyperlink to the new URI(s).Note: For historical reasons, a user agent MAY change the request method from POST to GET for the subsequent request. If this behavior is undesired, the 307 (Temporary Redirect) status code can be used instead.
A 301 response is cacheable by default; i.e., unless otherwise
indicated by the method definition or explicit cache controls
303
The 303 (See Other) status code indicates that the server is
redirecting the user agent to a different resource, as indicated by a URI in the Location header field, which is intended to provide an
indirect response to the original request. A user agent can perform
a retrieval request targeting that URI (a GET or HEAD request if
using HTTP), which might also be redirected, and present the eventual result as an answer to the original request. Note that the new URI
in the Location header field is not considered equivalent to the
effective request URI.This status code is applicable to any HTTP method. It is primarily used to allow the output of a POST action to redirect the user agent
to a selected resource, since doing so provides the information
corresponding to the POST response in a form that can be separately
identified, bookmarked, and cached, independent of the original
request.A 303 response to a GET request indicates that the origin server does not have a representation of the target resource that can be
transferred by the server over HTTP. However, the Location field
value refers to a resource that is descriptive of the target
resource, such that making a retrieval request on that other resource might result in a representation that is useful to recipients without implying that it represents the original target resource. Note that
answers to the questions of what can be represented, what
representations are adequate, and what might be a useful description
are outside the scope of HTTP.Except for responses to a HEAD request, the representation of a 303 response ought to contain a short hypertext note with a hyperlink to
the same URI reference provided in the Location header field.
Google 说:
Redirect your users and search engines to the HTTPS page or resource with server-side 301 HTTP redirects.
我建议遵循 Google 的建议,而不是尝试实施 303 策略。
来源:https://support.google.com/webmasters/answer/6073543?hl=en
当您将 http 重定向到 https 时,本质上您希望从 SEO 角度保留 "link juice"。
如您所知,Google 考虑网站排名的后退次数link。
301 和 303 重定向的主要区别本质上是它是否传递 link 果汁。像您提到的那样存在技术差异,但从 SEO 的角度来看,301 是更好的选择。
这是一篇博客 post,它展示了 303 可能如何影响您网站的搜索引擎优化。 https://digitalreadymarketing.com/303-redirect-effect-seo/
如果您有兴趣了解有关重复内容的更多信息(http 和 https 是典型的重复内容问题),请查看此 post。 https://digitalreadymarketing.com/what-is-duplicate-content-how-to-find-solve-them/