Let's popularize the difference between status codes 301 and 302
The 301 Moved Permanently requested resource has been permanently moved to a new location, and any future references to this resource should use one of the several URIs returned in this response. If possible, clients with link editing should automatically modify the requested address to the address returned from the server. This response is also cacheable unless otherwise specified.
Resources requested by 302 Found now temporarily respond to requests from a different URI. Since such redirects are temporary, the client should continue to send future requests to the original address. This response is cacheable only if specified in Cache-Control or Expires. 301 is suitable for permanent redirects
The most common scenario for 301 is to use domain name jumps. For example, we visithttp://www.baidu.comwill jump tohttps://www.baidu.comAfter sending the request, a 301 status code will be returned, and then a location will be returned, prompting a new address, and the browser will take this new address to access. Note: 301 requests can be cached, i.e. by looking at the status code, you can find that it says from cache at the end. Or you change the name of your web page from php to html, and in the process, a permanent redirect will also occur.
302 is used for temporary jumps
For example, users who are not logged in are redirected to the login page when they visit the user center. Visiting a 404 page redirects to the home page.
The configuration of Alibaba Cloud Load Balancing SLB is as follows:
We use http to redirect to https, the obvious intention is to redirect permanently, not temporarily, but here Alibaba Cloud gives me what we returnTemporary redirect 302 status code。 As shown below:
The return status code tested online with Webmaster's Home and Aizhan Network is 302, and I also used the code to return the 302 status code.
Case Study: Website 302 redirects were penalized by GOOGLE for improper use
Business.com is the largest business search engine and category on the Internet, with a reputation for providing business information professionally, including nearly 190,000 web pages. If you search Google for the keyword "business", the website will be ranked first. However, on September 5, 2010, Business.com encountered a strange thing: its homepage PR changed from 8 to 0, and the homepage could not be found in Google search results. Fortunately, it is only the homepage that is "evaporated". But fortunately, the homepage returned to Google's search results the next day, but the PR was still 0.
Link:The hyperlink login is visible.
I am on the Baidu webmaster platform "HTTPS authentication" today, and found that a site https verification failed, which aroused my vigilance.
There is no difference between 302 and 301 in terms of function, but it should have a very big impact on SEO, or it is divided into two different status codes.
Since this site uses intelligent DNS resolution, you can set different addresses for different regions, this site only distinguishes between domestic and foreign, domestic Alibaba Cloud, foreign Amazon AWS, as shown in the figure below:
Using the webmaster's home ping test, I found that there are 29 independent IPs, although the resolution addresses are different, but they all redirect the URL http to https.
I tested Alibaba Cloud SLB and Amazon CDN with code, and the result returned by HTTP redirect https is as follows:
The only difference in requests is that when testing Amazon, you have to make a request through a proxy, so that you can go abroad to parse and attach the code:
Before testing, a ticket has been submitted to Alibaba Cloud, as shown in the figure below:
As of this point, it has not been resolved and the reason has not been explained.
(End)
|