The difference between 301 and 302

Status code 301 and 302 the difference between the

 

It is defined as follows:

301 Moved Permanently requested resource has been permanently moved to a new location, and any future references to this resource should be used in response to one of several present URI returned. If possible, have a link editing capabilities of the client request should automatically be modified to address feedback from the server back address. Unless otherwise specified, otherwise the response is cacheable.


302 Found requested resource is now the temporary response to a request from a different URI. Because of this redirection is temporary after, the client should continue to be sent to the address of the original request. When only is specified in the Cache-Control or Expires in this response it is cacheable.

The difference is literally 301 is a permanent redirect, and 302 is a temporary redirect . Of course, there is also common ground between them, is that the user can see a new order to replace the url and then issue the request.

 

 

301 for permanent redirect

  301 of the more common scenario is to use a domain name to jump.

  For example, we visit HTTP : //www.baidu.com will jump to HTTPS : //www.baidu.com, after sending a request, it will return a 301 status code, then return to a location, suggesting a new address, browser We will take this new address to visit. 

  NOTE: 301 is the request can be cached, i.e., by looking at the status code, can be found written back from cache.

     Or you put your name to modify web page from php html, this process will permanently redirect occurs.

 

 

302 used for temporary jump

  For example, users access the user is not logged center redirected to the login page.

  Access 404 pages will be redirected to the home page. 

## niginx 301/302 Configuration

Behind rewrite connected permenent represents 301 jump

// the request 301 from veryyoung.me jump www.veryyoung.me 
IF (= Host $! ' Veryyoung.me ' ) { 
    the rewrite ^ / HTTP $ (*.): // www.veryyoung.me/$1 Permanent ; 
}

 

Connect redirect on behalf of 302 jump

// the request 302 from the jump veryyoung.me www.veryyoung.me 
IF (= Host $! ' Veryyoung.me ' ) { 
    the rewrite ^ / HTTP $ (*.): // www.veryyoung.me/$1 the redirect ; 
}

 

 

The difference between 301 and 302 redirect redirect

  301 Moved Permanently. The requested resource has been permanently moved to a new URI, return information will include new URI, the browser will automatically be directed to the new URI. Any future new request should be used instead of the new URI

  The temporary move. Similar to the 301. But the resource only temporarily moved. The client should continue to use the original URI

  

It is defined as follows:

301 Moved Permanently requested resource has been permanently moved to a new location, and any future references to this resource should be used in response to one of several present URI returned. If possible, have a link editing capabilities of the client request should automatically be modified to address feedback from the server back address. Unless otherwise specified, otherwise the response is cacheable.


302 Found requested resource is now the temporary response to a request from a different URI. Because of this redirection is temporary after, the client should continue to be sent to the address of the original request. When only is specified in the Cache-Control or Expires in this response it is cacheable.

The difference is literally 301 is a permanent redirect, and 302 is a temporary redirect . Of course, there is also common ground between them, is that the user can see a new order to replace the url and then issue the request.

 

 

301 for permanent redirect

  301 of the more common scenario is to use a domain name to jump.

  For example, we visit HTTP : //www.baidu.com will jump to HTTPS : //www.baidu.com, after sending a request, it will return a 301 status code, then return to a location, suggesting a new address, browser We will take this new address to visit. 

  NOTE: 301 is the request can be cached, i.e., by looking at the status code, can be found written back from cache.

     Or you put your name to modify web page from php html, this process will permanently redirect occurs.

 

 

302 used for temporary jump

  For example, users access the user is not logged center redirected to the login page.

  Access 404 pages will be redirected to the home page. 

## niginx 301/302 Configuration

Behind rewrite connected permenent represents 301 jump

// the request 301 from veryyoung.me jump www.veryyoung.me 
IF (= Host $! ' Veryyoung.me ' ) { 
    the rewrite ^ / HTTP $ (*.): // www.veryyoung.me/$1 Permanent ; 
}

 

Connect redirect on behalf of 302 jump

// the request 302 from the jump veryyoung.me www.veryyoung.me 
IF (= Host $! ' Veryyoung.me ' ) { 
    the rewrite ^ / HTTP $ (*.): // www.veryyoung.me/$1 the redirect ; 
}

 

 

The difference between 301 and 302 redirect redirect

  301 Moved Permanently. The requested resource has been permanently moved to a new URI, return information will include new URI, the browser will automatically be directed to the new URI. Any future new request should be used instead of the new URI

  The temporary move. Similar to the 301. But the resource only temporarily moved. The client should continue to use the original URI

  

Guess you like

Origin www.cnblogs.com/ZKPython/p/11115003.html