Home >Common Problem >What is the difference between common status codes 301 and 302?
Commonly used status codes 301 and 302 are both HTTP redirection status codes. The difference between them is: 1. 301 indicates that the requested resource has been permanently moved to a new location, while 302 indicates that the requested resource has been permanently moved to a new location. The requested resource is temporarily moved to a new location; 2. When 301 redirects, the search engine will transfer the search ranking of the original URL to the new URL, while when 302 redirects, the search engine will not transfer the search ranking of the original URL. The ranking is passed to the new URL.
# Operating system for this tutorial: Windows 10 system, Dell G3 computer.
Commonly used status codes 301 and 302 are HTTP redirect status codes, which indicate that the resource requested by the browser or client has been permanently (301) or temporarily (302) transferred to another location.
The differences are as follows:
301 Moved Permanently: Indicates that the requested resource has been permanently moved to a new location. Search engines will pass the search rankings of the original URL to the new URL. When you apply a 301 redirect, the browser or client caches the redirect and sends future requests directly to the new location.
302 Found (temporary redirection): Indicates that the requested resource has been temporarily moved to a new location. Search engines do not transfer the search rankings of the original URL to the new URL. When applying a 302 redirect, the browser or client sends the request to the original location every time instead of caching the redirect.
In summary, the 301 status code is used for permanent redirects, usually when the website structure changes or the old URL is migrated to a new URL. The 302 status code is used for temporary redirection, usually for temporary maintenance, access restrictions, or jumping to other functional pages.
The above is the detailed content of What is the difference between common status codes 301 and 302?. For more information, please follow other related articles on the PHP Chinese website!