Which Redirect to Use for SEO, a 301 or 302?

Using a Redirect on Your Website

Whenever you create a new page on your website that is going to replace an already existing page, even temporarily, you need to add a redirect. A redirect let's the search engines know which website to direct visitors to when click on your title tag in the SERPs and can preserve your SEO efforts. Whenever you change any URL that is already indexed, you must add a redirect.

Depending on the reasoning for the redirect, it may affect your website's traffic, whether negatively or positively. However, there are proper steps that you can take to try to preserve almost all your traffic. That being said, when possible, do not change URLs regularly.

The Difference Between a 301 Redirect and a 302 Redirect

Using redirects on your website might be necessary evil for your marketing strategy. It may be that you are totally transforming your site forever and switching domains, or to HTTPS. One the other hand, you might be temporarily doing a marketing promotional campaign and plan to switch back to the original page in a month. Whatever the reason, it's best to understand the difference of a 301 and a 302 redirect and how it can affect your SEO.

A 301 Redirect: The Permanent Redirect 

A 301 redirect is a permanent redirect that tells a search engine that a page has been moved permanently to another web address. Almost all of the SEO factors (e.g credibility and link juice) that the original page possessed is passed on. The original page is also replaced in a search engine’s index with the new page. 

301 Redirect Use Cases:

  • Moving from HTTP to HTTPs 
  • www to non-www
  • Switching domain names (website migration)
  • Forever switching the URL of a page
  • Resolving or preventing duplicate content problems

A 302 Redirect: The Temporary Redirect 

A 302 redirect is a temporary redirect that tells a search engine that a page has moved temporarily to another URL, and the original page will be brought back online after a certain period of time. All SEO qualities a original page has is retained but not transferred over. Google claims that it does pass on the PageRank to the new page; however, it is unclear if other search engines do this as well. Due to how each engine handles a 302 differently, it is not recommended to use this often

302 Redirect Use Cases:

  • Carrying out tests for a new page but not wanting to hurt the rankings of the original page
  • Redirecting users from the main website to a backup website while fixing the technical difficulties of the original
  • Special promotions

How to Do a 301 Redirect

For most websites, a web server’s behavior is configured through a .htaccess file - a simple text file that rests in the root folder of your website. This is where your homepage resides as well.

htaccess file for redirect

To perform a 301 redirect, you will need to:

  1. Place a .htaccess file in your root folder (if it does not exist already).
  2. Create or edit the .htaccess file using any plain-text editing tools (such as Notepad or TextEdit).

Example:

You want to do a 301 redirect from http://www.website.com/a.html to http://www.website.com/b.html.

The code in the .htaccess file would look something like this:

redirect 301 /a.html http://www.website.com/b.html

A 301 Code Breakdown:

  • redirect 301 - sets the HTTP 301 redirect status to tell search engines that the page has been moved permanently
  • /a.html - the original location of the page
  • http://www.website.com/b.html - the new location of the page for your server to redirect visitors to. (this part of the code requires the complete URL to work.)

If you have multiple pages that require redirects, you will need to create a new line of code for each of the pages.

How to Do a 302 Redirect

Note: All search engines handle a 302 redirects differently. The wrong usage of 302 redirects can hurt your search rankings dramatically.

Implementing a 302 redirect is similar to a 301 redirect.

To perform a 302 redirect, you will need to:

  1. Place a .htaccess file in your root folder (if it does not exist already).
  2. Create or edit the .htaccess file using any plain-text editing tools (such as Notepad or TextEdit).

Example:

You want to do a 302 redirect from http://www.website.com/a.html to http://www.website.com/b.html.

The code in the .htaccess file would look something like this:

redirect 302 /a.html http://www.website.com/b.html


A 302 Code Breakdown:

  • redirect 302 - sets the HTTP 302 redirect status to tell search engines that the page has been moved temporarily
  • /a.html - the original location of the page
  • http://www.website.com/b.html - the new location of the page for your server to redirect visitors to. (this part of the code requires the complete URL to work.)


If you have multiple pages that require redirects, you will need to create a new line of code for each of the pages.

With this new piece of knowledge in mind, begin redirecting your pages accordingly to bring the best out of your SEO and website restructuring. Each redirect was designed to suit a specific purpose - be it moving pages permanently or temporarily redirecting users to a page to resolve downtime issues.

Most of all - be sure to use a redirect only when necessary. Any form of redirection will affect your SEO.