301: Moved Permanently
Client should automatically re-link references to the Request-URI to one or more of the new references returned by the server, where possible
Response
- This response is cacheable
- New permanent URI SHOULD be given by the
Location
field in the response
- Unless the request method was
HEAD
, the entity of the response SHOULD contain a short hypertext note with a hyperlink to the new URI(s)
In scope of search engine crawler
- When a search engine spider finds 301 status code in the response header of a webpage, it understands that this webpage no longer exists, it searches for location header in response pick the new URL and replace the indexed URL with the new one and also transfer pagerank.
- So search engine refreshes all indexed URL that no longer exist (301 found) with the new URL, this will retain your old webpage traffic, pagerank and divert it to the new one (you will not lose you traffic of old webpage).
In scope of browser
- If a browser finds 301 status code then it caches the mapping of the old URL with the new URL, the client/browser will not attempt to request the original location but use the new location from now on unless the cache is cleared.
302: Found
Requested resource resides temporarily under a different URI
- Since the redirection might be altered on occasion, the client SHOULD continue to use the Request-URI for future requests
Response
- This response is only cacheable if indicated by a
Cache-Control
or Expires
header field
- The temporary URI SHOULD be given by the
Location
field in the response
- Unless the request method was
HEAD
, the entity of the response SHOULD contain a short hypertext note with a hyperlink to the new URI(s)
In scope of search engine crawler
- When a search engine spider finds 302 status for a webpage, it will only redirect temporarily to the new location and crawl both of the pages.
- The old webpage URL still exists in the search engine database and it always attempts to request the old location and crawl it.
In scope of browser
- The client/browser will still attempt to request the original location.