302 redirect

One, 301 sum 302

The overall performance is the user sees the URL into a new

Let us talk about 301: permanent redirect, enter this address is wrong, it will prompt a new address, the address can be obtained from the cache ( that is, by looking at the status code, can be found written on the back of Cache from )

301 redirect is a permanent redirect, search engines will be replaced after the redirect URL in order to grab new content while the old URL.

Code performance is this:

Behind rewrite connected permenent represents 301 jump

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


302 (reflected in the landing page): temporary redirect, search engines will crawl new content and keep the old address, because the server returns a 302, so the search search engines that the new URL is temporary. Temporarily from a different URL request, due later this redirection is temporary, 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.
User performance: not logged in user access User Center redirected to the login page. Access 404 pages will be redirected to the home page. 
Code Performance:

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 ; 
}









Guess you like

Origin www.cnblogs.com/huanlfu/p/11183688.html