Academy

What is a 301 redirect?

A 301 redirect refers to the HTTP status code 301 which indicates that content has permanently moved from URL A to URL B. Because of the permanent nature of the 301 redirect, authority and relevance of URL A carries over to URL B.

When you need to redirect URLs, in most cases you’ll want to use a 301 redirect. Because it carries over authority and relevance to another URL, it is an essential tool in every SEO expert’s toolbox.

301 redirect: permanently moved content
301 redirect: permanently moved content

Why should you use 301 redirects?

When your content moves, you want to make sure it affects your SEO performance as little as possible. That’s where the 301 redirect comes in.

If you don’t implement 301 redirects when content moves, both visitors and search engines will have a hard time figuring out where the content moved to. VIsitors will hit a 404 page, and search engines will not be able to attribute any built up relevance and authority to the new URL. This results in your rankings dramatically dropping.

Website visits going down

How does a 301 redirect work?

We’ll explain how 301 redirects work with a simplified example of a client that request an redirected URL:

Step 1: Request

A client requests a URL from a server:

GET /old-url/ HTTP/2
Host: www.example.com

Step 2: Server response

The server looks up the URL and finds it’s been permanently moved, which it replies to the client:

HTTP/2 301
location: https://www.example.com/new-url/

Step 3: New request

The client requests the URL the content has been moved to:

GET /new-url/ HTTP/2
Host: www.example.com

Step 4: Server response

The server sends back that everything is OK, and sends the URL’s assets along as the payload:

HTTP/2 200
Keep on reading about 301 redirects

When would you use 301 redirect?

You implement 301 redirects to make sure visitors and search engines that visit an old URL are redirected to its new URL.

In SEO, there are many situations in which you’ll need to do this. Here are some common examples:

  • You’ve changed a page’s URL (see the example above).
  • You’ve changed a subfolder’s URL (e.g. https://example.com/old-folder/ to https://example.com/new-folder/).
  • You’ve moved a subdomain to a subfolder (e.g. https://blog.example.com to https://example.com/blog/).
  • You’ve changed domain names.
  • You’ve switched from HTTP to HTTPS.

You get the idea: any time content has moved you want to make sure both visitors and search engines don’t end up on 404 pages. That’s where redirects come in.

What happens to a page that’s 301 redirected?

While a redirected page can still exist within a Content Management System, it won’t be available anymore to visitors and search engines.

Search engines will consolidate the old URL with the new URL, and stop showing the old URL in their search results. The time search engines need to stop showing the old URL completely varies, in practice we see this can take anywhere from a few days to a few months.

How do I create a 301 redirect?

In this section we’ll discuss creating 301 redirects on Apache, nginx and WordPress.

How do you create a 301 redirect on Apache?

On Apache webserver, redirect rules are kept in the .htaccess file.

Here’s a simple example of implementing a 301 redirect on Apache to redirect /old-page/ to /new-page/:

<IfModule mod_rewrite.c>
RewriteEngine On
RedirectMatch 301 /old-page/ /new-page/
</IfModule>
Useful resources

How do you create a 301 redirect on nginx?

On nginx, redirects are kept in your nginx.conf file.

Here’s how to implement that same 301 redirect from the Apache example, on nginx:

server {
    rewrite ^/old-page/$ /new-page/ permanent;
}
Keep on reading about server response codes

How do you create a 301 redirect in WordPress?

The easiest way to create 301 redirects in WordPress is through a plugin.

There are plenty of plugins available, with the most popular one being Redirection with over a million installs. Let’s use that plugin to redirect /old-url/ to /new-url/:

Redirection WordPress plugin to set up 301 redirects
Setting up redirects with Redirection plugin in WordPress

Hit the blue Add Redirect button and you’re done.

Pro tip

Creating redirects in a CMS should be treated as a last resort. It’s highly recommended to create 301 redirects on a web server level, because: a) It’s much faster. b) It’s best to keep track of redirects in one place. It’s easy to run into conflicting redirects if you’re managing them in two places. Managing redirects is tricky enough, don’t complicate it further.

Can you change a 301 redirect?

Yes, by adjusting the server configuration files as described above, or by adjusting redirects that are configured through a plugin you can adjust them at will.

Be careful when changing 301 redirects though; it’s easy to make mistakes that result in redirect loops or URLs that stop redirecting all of a sudden. Test any adjustments you’ve made carefully.

Are redirects hurting your SEO performance?

Redirects may be holding back your SEO performance.
Check your website for excessive redirects right away!

Please enter a valid domain name (www.example.com).

Can you have too many 301 redirects?

If we’re talking about the amount of redirects that are implemented for a website, then the answer is “no” in 99,99% of the cases.

If we’re talking about chained redirects, such as for example when URL A redirects to URL B, which in turn redirects to URL C and so on, then “yes”. Chained redirects are bad from both an SEO point of view and a visitor point of view, because crawlers and browsers will stop following the redirects.

Useful resources

How long for 301 redirects to take effect?

That depends on your website’s crawl budget (how much attention search engines can give your website).

It’s common to see that redirects implemented on authoritative sites are picked up faster than on smaller, less authoritative sites.

As a rule of thumb, count on a few days up to a few weeks.

Are there situations in which not to implement 301 redirects?

Yes, for example when content hasn’t been moved permanently. In that case, you need to use a 302 redirect.

When you use a 302 redirect, both URLs remain indexed and browsers will not cache the redirect.

Useful resources

How do 301 redirect affect browser behaviour?

Browsers aggresively cache 301 redirects. When you remove a 301 redirect, and you request the URL that was previously 301 redirected, it can look like the redirect is still in place, while in reality it’s your browser that’s cached the redirect.

In order to fix this, you need to purge the browser’s cache (a æhard refresh” using CMD + R or CTRL + F5 isn’t enough).

ContentKing Academy

Read the full Academy article to learn everything about Redirects

Start your free 14-day trial

Get up and running in 20 seconds

Please enter a valid domain name (www.example.com).
  • No credit card required
  • No installation needed
  • No strings attached