What are Redirects?

In web terminology, redirection refers to moving users (including search engine crawlers like Googlebot) to another file or from one web address to another, such as a webpage being moved or moving to a new secure homepage after logging in to an account from a login screen. These can be initiated from within the browser (client side) using JavaScript for example, or from the server side using a serverside language such as PHP. Where a webpage has been relocated permanently a server-side HTTP 301 status code is used, whereas HTTP 302 status codes are used for a temporary change of address.

Proper use of HTTP 301 status codes

SEO best practices dictate that you should use a server-side HTTP 301 status code to permanently redirect traffic and search engine crawlers to the correct URL when appropriate, for instance when upgrading sites from HTTP to HTTPS.

Proper use of HTTP 302 status codes

There are instances where you need to temporarily redirect traffic and search engine crawlers, in which case it is preferable to use HTTP 302 status codes. In general if you’re not sure where you want to redirect people to, or you are not certain if the redirect is a permanent change then you should use HTTP 302 status codes.

A common scenario where 302 redirects are preferable over 301 redirects can be found on ecommerce sites where products go in and out of stock frequently. For instance the product listing page (and its category pages, if there’s no other products in them) become redundant when products are out of stock, so ecommerce sites often want to redirect users up to the nearest relevant category. It is definitely not wise to make that a permanent redirect because when the product comes back into stock we want to remove the redirect so search engines can direct traffic towards the product page once more.

If you were to use a permanent 301 redirect for a temporary change, browsers and search engines would remember the change, hence when you remove the redirect google is slower to respond and browsers may overlook any changes after you remove the redirect notice, thus reducing the chance of the redirected content being ranked in SERPs. Search engines may also penalise you for making changes to a supposedly ‘permanent’ redirect notice.