301 redirects

What are 301 redirects in SEO?

A 301 redirect is a server-level method to automatically and instantly redirect a user from one URL to another URL. It also tells search engine bots like Googlebot that the indexed URL has permanently moved to a new URL.

When accessing a URL, servers have a number of different response codes. For example, a 404 response means that the requested URL could not be found. A 301 response code means that the URL has permanently been redirected to a new URL.

When a website wants to move a web page to a different URL, any links pointing to the original URL will be broken and users will see a 404 error if they visit that page.

By setting up a 301 redirect in the .htaccess file, the user will automatically be redirected to the new URL without ever knowing that it happened.

You can use the following code in your .htaccess file to permanently redirect a URL to a new one:

RedirectMatch 301 /products/oldURL/ /product/newURL/

The code above would automatically redirect any visitors to www.example.com/products/oldURL to the new URL www.example.com/product/newURL/

Sometimes websites might want to drop the ‘www’ subdomain from their website address. This is because the following URLs are each treated as separate pages and could cause issues when search engines index your website:

  • http://www.example.com
  • https://www.example.com
  • http://example.com
  • https://www.example.com

To redirect traffic to any one of the URLs above to a single URL you can use this code in your .htaccess file:

RewriteCond %{HTTP_HOST} ^(.*)$ http://example.com/$1 [L,R=301]

In SEO, 301 redirects are used because Google may have indexed the old URL and when the Googlebot next visits that URL it may encounter a 404 page and de-index the page – even though it still exists but on the new URL.

The 301 redirect also tells Google that the original URL no longer exists as the page has moved to a new URL.

If 301 redirects are not used then over time the website might have fewer pages indexed by Google and users will encounter more and more 404 errors.

Learn more about 301 redirects


Posted

in

by

Tags:

Comments

One response to “301 redirects”

  1. Ross Avatar

    Most companies implement 301 redirects wrong and end up causing more harm than good.

Leave a Reply

Your email address will not be published. Required fields are marked *

Enter your human name, not your company name or a keyword.