Speaking of the redirects for SEO, they are pretty simple. If you want to move your content temporarily then you have to use a 302 redirect. And if you want to remove your content permanently, then you have to use a 301 redirect. Now, the point is, this doesn’t really matter to the user and they cannot tell the difference. However, it is important for search engines.
The search engines view redirect 301 and 302 differently. Thus, if you choose the wrong one, it will cause SEO issues and you may not be able to figure it out for a long time.
When should you use a 302 redirect?
- For redirecting the user to the right website version
- A/B testing the functionality of the website
- To get feedback on a new page without damaging the rankings of an old one
- If you are running a promotion and want to redirect the visitors to the sales page
When to use a 301 redirect?
- Changing the URL of a website permanently
- Migrating to a new domain
- Switching from HTTP to HTTPS
- Fixing the non-www.www duplicate content issues
- Permanently merging two more pages or websites
- Changing the URL structure completely
How does Google treat 301 and 302 redirects?
Since the functions of both the redirects are almost identical, it might be confusing which one to use. To know which one to use, you have to know how Google treats both the redirects.
There are two important factors:
- Link signals
- Indexation
Link Signals
3XX redirects use diluted Page Rank however that stopped in 2016. While redirecting one URL to another, the link signals get consolidated at one URL without dilution.
For the 301 redirects
The link signals consolidate ‘forward’ to the new URL. For instance, if the old-page.html comes with ten backlinks and you redirect that to a new page using 301 redirects for SEO, all the link signals will get accumulated at the new-page.html. In simple terms, Google should rank the new-page.html because it has ten links.
However, things are not that simple. This is not a problem if you are moving the content in a new URL without changing it. However, if the redirect is irrelevant, like, redirecting the old blog page to the homepage, then the links of the old page will not help the new page to rank. This is why the golden rule is to keep the redirects as relevant as possible.
You can try the following:
- Go the Search Console and then click on Links and then go to External Links
- Filter the report using the “target page” and then paste in the “new” URL.
- Next is, paste the “old” URL and then visit the referring domains report.
- Finally, in the GSC, you can filter the links by “site” and then paste it in referring domains.
When you do this for several referring domains and there are no matches in the GSC, Google will treat the redirect as soft 404 and it will not count the backlinks towards the ‘new’ URL. If there is a match, you can click on the site to check the actual links. The Target URL column will show the ‘old’ redirected URL.
For the 302 redirects
The link signals consolidate ‘backward’ in the old URL. For instance, if you use a 302 redirect for SEO of the old-page.html and the new-page.html comes with ten backlinks, the link signals will come. Thus, in simple terms, Google is supposed to rank old-page.html because it has ten links.
Again, things are not that simple. It will depend on how Google treats the 302 redirect. If they treat this as a temporary redirect the link signals will consolidate backward, assuming that the redirected page is identified as the new page. If not, then it might get treated as a soft 404.
When they are treated as a permanent redirect, then the link signals will be consolidated forward. You will be able to check how Google is treating a redirect along with the URL Inspection Tool.
Indexation
For the 301 redirect
It will be a new URL. When you use a 301 redirect from an old page to a new page then Google will index the new page and de-index the old page. Since a 301 redirect tells Google that it is a permanent move, there is no point in indexing the old URL.
A lot of time people get confused about this because after a 301 redirect the old URL can still come up for a while in Google.
For the 302 redirect
This time the URL that Google indexes will be the original one. However, since Google understands that people use 302 redirects mistakenly for permanent redirects, it evaluates every 302 redirect to determine what you meant.
No one knows how long a 302 redirect should be in place before Google treats it as a permanent redirect. Mostly it takes a few weeks to a few months. In some cases, Google even treats the 302 as 301s. If you are not sure how Google is treating the 302 redirects, then here is a quick help.
Simply paste the redirecting URL within the search console’s URL Inspection tool. Now if it shows that the URL is not on Google, then Google is treating the redirect as permanent. If it is there on Google, then they are treating it as temporary.
Have a look at the last crawl date while doing this. If it comes after the redirect is used, then request for a re-indexing and then come back later.
How to create a 301 redirect?
For creating the 301 redirect for SEO from one URL, you have to add the following to the .htaccess file:
Redirect 301 /old-page.html /new-page.html
You can also do this using the RankMath or Redirections plugin. Choose the kind of redirect you want and then add the source and destination URLs.
To redirect the complete website, you have to add this to the .htaccess file:
RewriteEngine on RewriteCond %{HTTP_HOST} ^oldsite.com [NC,OR] RewriteCond %{HTTP_HOST} ^www.oldsite.com [NC] RewriteRule ^(.*)$ https://newsite.com/$1 [L,R=301,NC]
How to create a 302 redirect?
To create a 302 redirect, you have to add this to the .htaccess file:
Redirect 302 /old-page.html /new-page.html
To redirect the complete website, you can use the following code:
RewriteEngine on RewriteCond %{HTTP_HOST} ^oldsite.com [NC,OR] RewriteCond %{HTTP_HOST} ^www.oldsite.com [NC] RewriteRule ^(.*)$ https://newsite.com/$1 [L,R=302,NC]
In conclusion, you need to remember that the redirects are not complicated. The best thing is, even if you use the wrong redirect, Google might figure out what you actually meant. However a lot of times it may not happen as well. This is why it is best to double-check the redirects before using them.