What is a 301 redirect code and how does it affect SEO?
What is a 301 redirect code?
A 301 redirect (opens in a new tab) signals to search engines that content has permanently moved to another URL. Because of the permanent nature of the 301 redirect, authority and relevance carry over to the redirect’s target.
When you need to redirect URLs, in most cases a 301 redirect is what you want. Because it carries authority and relevance over to another URL, it is an essential tool in every SEO expert’s toolbox.
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 301 redirects come in.
If you don’t implement 301 redirects when content moves, both visitors and search engines will have trouble figuring out where that content moved to. Visitors hit a 404 page, and search engines can’t send any built up relevance and authority to the new URL. This drops your rankings dramatically.
How does a 301 redirect work?
We’ll explain how 301 redirects work with a simplified example of a client that’s requested a redirected URL:
Step 1: Client makes a request
A client requests a URL from a server:
Step 2: Server responds
The server looks up the URL and finds that its content has been permanently moved. It replies with this to the client:
Step 3: Client makes a new request
The client requests the URL that the content has been moved to:
Step 4: Server responds to new request
The server answers that everything is OK, and sends the URL’s assets along as the payload:
In which situations are 301 redirects commonly used?
301 redirects are commonly used when:
- You’ve changed a page’s URL (see the example above).
- You want to consolidate pages about the same topic.
- You’ve changed a subfolder’s URL (e.g.
- You’ve moved a subdomain to a subfolder (e.g.
- You’ve changed domain names (e.g.
- You’ve switched from
You get the idea: any time content that carries some value moves, you want to ensure neither visitors nor search engines end up on 404 pages. That’s where redirects come in.
How do I create a 301 redirect?
In this section we’ll discuss creating 301 redirects on Apache, nginx, WordPress and Shopify.
Creating 301 redirects on Apache
On the Apache webserver, redirect rules are kept in the
Here’s a simple example of implementing a 301 redirect on Apache to redirect
Creating 301 redirects on nginx
On nginx, redirects are kept in your
Here’s how to implement our example 301 redirect on nginx:
Creating 301 redirects on WordPress
The easiest way to create 301 redirects on WordPress is through a plugin such as Redirection (opens in a new tab).
Let’s use that plugin to implement a simple redirect from
Creating 301 redirects on Shopify
Shopify’s SEO toolbox comes with a built-in redirect manager. And when you change page URLs, it’ll always ask you whether you want to add a 301 redirect.
You can add redirects manually, or import a list of redirects. Here’s how to implement a simple 301 redirect:
Creating 301 redirects directly on CDN
There is one other great way—unknown to most SEOs—to implement 301 redirects: via a CDN like Cloudflare or Akamai. Load times decrease dramatically when you’re implementing redirects directly on a CDN, because a client only has to make one request.
See below for how to implement 301 redirects using Cloudflare.
Here are some useful tools that will help you set up, redirect, and diagnose redirect issues.
- Audit 301 redirects with ContentKing
- Aleyda Solis’ htaccess redirect generator (opens in a new tab)
- htaccess to nginx converter (opens in a new tab)
- Chrome plugin: Redirect path (opens in a new tab)
Frequently asked questions
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 to visitors and search engines anymore.
Search engines will consolidate the old URL with the new URL and hide the old URL in their search results. The time the engines need before they completely hide the old URL varies; in practice we see this take anywhere from a few days to a few months.
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 change them at will.
Be careful when changing 301 redirects though; it’s easy to make mistakes that cause redirect loops or URLs that suddenly stop redirecting. Carefully test any adjustments you’ve made.
Redirects may be holding back your SEO performance.
Check your website for excessive redirects right away!
Can you have too many 301 redirects?
If we’re talking about the number of redirects that are implemented for a website, then the answer is “no” 99.99% of the time.
If we’re talking about chained redirects, such as 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 viewpoint and a visitor viewpoint, because crawlers and browsers will stop following the redirects.
How long is it before my 301 redirects take effect?
That depends on how much attention search engines can give your website—also called its crawl budget.
It’s common for redirects implemented on authoritative sites to be picked up faster than those on smaller, less authoritative sites.
As a rule of thumb, count on a few days to a few weeks.
How long should you keep 301 redirects?
You need to keep 301 redirects in place indefinitely. If you remove them, when visitors and search engines request the old URL, they won’t be forwarded to the new URL anymore.
This leads to a poor user experience for visitors—and search engines will stop attributing the value of the old URL to the new URL.
Interestingly, old domains that aren’t renewed and thus stop redirecting are a common reason why rankings drop. Hold on to old domains that carry value, and keep your 301 redirects going!
Are there situations where you shouldn’t 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.
How do 301 redirects affect browser behavior?
Browsers cache 301 redirects aggressively. When you remove a 301 redirect, and you browse to the URL that was previously 301-redirected, it can look like the redirect is still in place, it’s really just that your browser has cached the redirect.
To fix this, you need to purge the browser’s cache. (Even a “hard refresh” using
CMD + R or
CTRL + F5 isn’t enough.)