What redirects are and what for they are used.
Redirection is a process of forwarding one URL to another. There are three main kinds of redirects: 301, 302, 307 and meta refresh. Today we are going to discuss the first two.
So what 301 and 302 redirects really mean?
Redirects are used to sent users and Search engines to another URL that they have requested. Below are explanation for 301 and 302 redirects.
301 Moved Permanently
This is a permanent redirect that passes 90-99% of link juice. 301 refers to the HTTP status code(there are a lot of them). 301 redirect is mostly used to substitute outdated page with a new one. Its implementation helps to avoid duplicated content issues among both Search Engines and users. 301 redirect is SEO friendly and should be used in most cases.
302 Moved Temporarily
This is a temporary redirect that passes 0% of link-juice. Usually it is used to temporary substitute a page that is outdated or temporarily not available. 302 is not SEO friendly and should not be used in most cases.
302 common problems and solutions
Magento is a great platform with a huge number of options and capabilities but 302 redirects is something that takes place on almost every eCommerce website. There a lot of issues about 302 redirection in Magento. Sometimes you set 301 redirect in System > Configuration > General > Web > Url Options but it keeps showing 302, sometimes you get alerts about a huge number of pages like example.com/wishlist/index/add/product/166/form_key/FKdrle8FIdk/ with 302 redirection, etc. During last few weeks we’ve got a lot of questions from our clients regarding second issue and that’s why we decided to clarify this problem.Magento automatically sets 302 redirects for urls like:
- Add to Compare
- Add to wishlist
- Switch currency
- Switch location
No fear, young Padawan. It’s not that scary as it looks. Let’s dig deeper why redirects are used.
So, as we know, 301 and 302 do the same thing from the users prospective. User hits the page and he’s redirected to another one with a blink of an eye. While users won’t see the difference between 301 and 302 redirects, search engines will. Let’s consider two situations:
- Let’s say you have Page A. As time passed, Page A became outdated so you decided to create Page B with up-to-date content to substitute Page A. In this case 301 redirect should be used as it tells Search Engines that these two pages are similar and Page B is just a newer version of Page A.
- There are pages that can be seen only by signed in users. In case a user that isn’t signed in tries to access this page, he gets redirected to login page. In this situation 302 redirect is used and it’s totally fine as there is no outdated page or page that needs to be substituted.
So why people are so concerned about this particular issue? Basically it happens because we got used that 302 is treated as unwanted and bad redirect while 301 is a Holy Grail among redirects. Most of SEO tools and manual audits from Marketing companies will tell you that 302 redirect harms your website and it should be changed to 301. But it’s not true if you have 302 in “Add to Compare”, “Add to wishlist”, “Currency and geolocation switch” types of links. Imagine that you decided to place 301 redirect for those links. Basically you’re telling Search Engines that all your “Add to Compare”, “Add to wishlist”, “Currency and geolocation switch” pages are outdated and are similar to login page. Do you want these pages to be treated as similar? I bet you don’t!
If you worry about passing link-juice, just search for external links that lead to pages like “product_compare”. I doubt that you find at least one, and if you do-there is something wrong with your link-building strategy.
So, What should I do with 302 in wishlist, compare products, geolocation switch links?
- Keep 302 redirects
- Disallow indexing these URLs in your robots.txt
- Relax and have a cup of coffee
If you have any questions about anything I’ve mentioned in this blog post or anything else related to Magento, please feel free to drop me a message via this form.