Understanding 301 Redirects in WordPress (Or: How to Not Ruin Your Client’s SEO)

picard double face palm | seo

I find working as a WordPress developer to be relatively low-stress. Giving people a good web presence is both a huge service, and something that doesn’t lead to massive tragedy if you’re not perfect at it right away. It’s not like being a fireman or a fighter pilot, for example.

There are exceptions, though: a few times when I’ve been so stressed-out and guilt-ridden that I’ve felt like quitting my job. What’s more, they’re all the same kind of exception. I’ve graphed it out, so I’ll let the data do the talking:

reasons why I've wanted to quit WordPress development

I’ve wanted to quit my job on the few occasions where I seriously damaged a client’s presence in organic search. SEO mistakes are so painful for a few reasons:

  1. They can cost your client a huge amount of money. If her site is her main source of income, SEO mistakes can damage or even destroy that livelihood.
  2. They’re extremely easy mistakes to make, if you’ve got good knowledge of WordPress development but not of the architecture of the internet.
  3. Once you’ve made a serious enough SEO mistake, it’s impossible to fix. Your client simply has to spend months rebuilding her lost rankings with the help of an SEO professional, and there’s essentially nothing you can do to help.

Our article on Discourage Search Engines covers one of the cases where I’ve messed things up majorly. Today I’m covering another, and it’s one that I constantly see less experienced developers put their clients through: not 301 redirecting changed permalinks, especially while transitioning a site to WordPress from another technology.

If you don’t know exactly what I’m talking about, strap in: you’re about to learn something that will save you from really hating your job.

301 Redirects: Core Concepts

This section isn’t a “How-To.” Rather, it covers the fundamentals of how Google thinks about webpages and web addresses, and why it needs to be kept happy during permalinks changes.

Search Rankings

Google’s search engine works by ranking individual webpages for specific searches. Based on lots of criteria, Google will make one or another webpage show up as its top result for a specific user search, then another webpage as its second result, and so on.

Because people do billions of Google searches a month, ranking high in Google can mean giant volumes of web traffic to your site—which can, in turn, mean huge amounts of sales, leads, ad impressions, petition signatures, or however you make money and/or meet your goals online.

The industry designed to help particular sites rank high in Google (and various other less important search engines) is called search engine optimization, SEO. “A page’s SEO” is an informal way of describing how well-favored it is by Google.

Permalinks

Google doesn’t rank search performance per website, but per webpage, and it links to a given webpage through its permalink.

Google doesn’t rank search performance per website, but per webpage. Let’s say that the page located at example.com/great-optimized-page performs really well, for whatever reason, in one or another high-volume Google search. Google will send tons of traffic to that page, and that page alone may be responsible for most of the site’s overall traffic and revenue, even if the rest of the site performs poorly in search.

A permalink (from “permanent link”) is a web address, or URL, that is designed to be the permanent address of that webpage. In our example, the page’s permalink is simply the URL example.com/great-optimized-page itself.

A page’s permalink is how Google sends traffic to it. It’s like the address to a popular restaurant that Google recommends lots of people visit. Google might absolutely love your restaurant, but if it suddenly didn’t know the restaurant’s address—if visitors who went on Google’s recommendation started bouncing back complaining, “Hey, there’s nothing here!”—then Google would simply have to stop sending traffic there.

What is a 301 Redirect?

Google says this pretty well, so let’s begin with their explanation:

If you need to change the URL of a page as it is shown in search engine results, we recommend that you use a server-side 301 redirect. This is the best way to ensure that users and search engines are directed to the correct page. The 301 status code means that a page has permanently moved to a new location.

So a 301 redirect is almost exactly like setting up a mail forward at the post office. You’re telling everybody: “Anything that comes for me at my old Los Angeles address should instead come straight to my new New York address. I’ve permanently moved.”

A 301 redirect is like that, but for a webpage. If, for any reason, example.com/great-optimized-page now needs to be located at a new address, you want to 301 redirect that page so that every visitor to the old address, both Google bots and actual human traffic, gets instantly and seamlessly forwarded to the new address. This is true whether the new address is completelynewdomain.org/great-optimized-page, or example.com/a-new-permalink, or anywhere else on the web.

301 Redirects and SEO

Just like the Post Office, Google will happily update its records when you correctly submit a “change of address” form. (In Google’s case, the “form” is the 301 redirect itself.) Shortly after you change a page’s permalink and 301 redirect the old permalink, Google will start linking to the new page in its search results, and will allow the page to retain nearly all of the ranking strength that it had at the old address.

What happens when you don’t set up address forwarding? Well, for a human changing her physical address, a lot of important “traffic” (wedding invites, tax forms, and so on) goes to an out-of-date address. A lot of returned packages make their way to the Post Office. Everything breaks.

It’s the same for a web address. If example.com/great-optimized-page changes address without some sort of forward, then all traffic to that address will simply break. There’s nothing there anymore, so trying to access the page will give you the familiar “Error 404,” which is simply a web server’s code for “There’s nothing here.”

Google doesn’t like sending search traffic to dead links (it’s bad for business), so it will very quickly forget about example.com/great-optimized-page, and let other pages that discuss a similar topic rank in its place. The page’s many years of steadily accumulating Google rankings are lost, often forever.

What Damaging a Client’s SEO Looks and Feels Like

So you’ve just moved a site onto WordPress. It was on some janky old technology—maybe a decades-old, half-broken e-commerce system—but because the site itself is also decades old and occupies a very defined niche in a particular marketplace, it has been ranking very well in Google search.

The new WordPress site is beautiful, lots faster, much easier to manage, and looks great on mobile phones: a clear win. However, during the move, you did migrate all the old site’s products into WooCommerce, but you didn’t forward the old product pages’ permalinks.

Six weeks pass, and then you get an email from your client: “I love my new site, but I just looked in Google Analytics and I’m suddenly getting almost no search traffic. Also, my sales dropped from $10,000 a month before the migration to just $500 last month. What’s going on?”

Now you realize your mistake—the old high-ranking pages are all 404ing because you didn’t redirect them to their new WordPress permalinks—but it’s too late to do anything about it. The site’s rankings are gone, Google has moved on, your client is losing thousands of dollars a month because of you, and you’re thinking about washing your laptop in the sink and joining fighter pilot school.

This type of horror story is a lot more common than you’d expect. For an average WordPress developer, it’s probably the biggest single danger to your clients, and to your own ability to “First do no harm.”

The remainder of this article covers what you can do to avoid stories like this, in specific kinds of WordPress situations.

1. Moving an Existing WordPress Site to a New Host

In many WordPress hosting migrations, there are no permalinks changes to 301 redirect.

This case is usually not very complicated. If you’re simply moving a WordPress site to a new host, without changing the site’s permalinks, then there are no permalinks changes that would require you to 301 redirect WordPress pages.

This is because, from Google’s standpoint, the site still has the same pages as it did before. Google is still expecting a page at example.com/great-optimized-page, and it still sees the same content there when it checks. The only thing that’s changed is that a different server is responsible for servicing requests to the page.

So in most cases, there’s not a ton to “do” from an SEO perspective when you move a WordPress site to a new host while keeping the site itself intact. You do still need to be alert, though, for at least two general considerations: site speed and handling SSL.

WordPress Migrations and SEO: Ensuring Optimal Site Speed

The first element with potential SEO impact in a WordPress hosting migration is site speed. Google rewards fast sites, so make sure you’re moving your clients to a faster environment, not a slower one, and try to be careful about any performance hiccups that might come up with the move. Google’s PageSpeed Insights is great for diagnosing and improving site performance.

Relatedly, it’s a pretty good idea to call the new host’s techs and make sure that the site is properly set up on the new hosting—for example, that the server’s caching is properly configured for the site. If you’ve just migrated to SiteGround (our favorites), you have to manually turn on their caching layers, and you’ll also want to disable caching plugins like W3 Total Cache, which host-level caching makes redundant. You wouldn’t necessarily know to do these things yourself, so call the host’s techs.

Other technical aspects of server configuration—like using the latest PHP versions and something called php-fpm that I don’t pretend to understand—can make a massive difference in site performance as well, so if PageSpeed Insights is indicating poor or middling performance, especially slow server response times, don’t be shy about calling in and seeing what can be done.

WordPress Migrations and SEO: Moving to SSL

The second SEO consideration in moving a WordPress site between servers is more technical, and it revolves around SSL certificates. If, in the course of your move, you’re also moving from a non-SSL environment (URLs that look like http://example.com) to an environment with an SSL certificate (URLs that look like https://example.com), you have to be careful.

The reason is because both Google and human visitors are still liable to look for resources at http://example.com—and, if you don’t stop them, they’ll still be able to end up at the old, unsecure version of your site. This means a lot of bad things:

  1. Most importantly, users will be able to do “should-be-secure” things like enter personal information or credit card numbers on an insecure version of your site. This is a very, very serious security risk.
  2. Your site analytics will be super-weird, because you’re only seeing either the secure or insecure set of site visits, while missing the other set.
  3. Because Google sees one set of pages at http://example.com and another set of identical pages at https://example.com, it will conclude that you have two separate sites with identical content, which sets you up for potential duplicate content SEO penalties.

Without going into too much more detail about the problem, let me tell you what you should do about it: install WP Force SSL, a brilliant and extremely simple plugin that redirects all http:// traffic to the https:// version of the same page. Follow its instructions with respect to WordPress’s General Settings, activate it, and you’re good to go.

There’s a fair amount else to making a newly-installed SSL certificate work properly, but with WP Force SSL running you’re clear of the concern that multiple site versions are hurting your SEO. And Google does actually reward SSL-enabled sites, so know that the move to SSL does benefit the site in the long run.

2. Moving a Non-WordPress Site Onto WordPress

If you’re moving a site from another technology onto WordPress, you must understand 301 redirects.

If you’re moving an existing site from another technology onto WordPress, you absolutely must understand 301 redirects, and how a WordPress 301 redirect can preserve the SEO value of an old non-WordPress page.

The reason is because different technologies use different permalink structures.

Different Technologies Use Different Permalink Structures

Let’s look at four webpages:

  1. example.com/great-optimized-page.html
  2. example.com/great-optimized-page.asp
  3. example.com/great-optimized-page.php
  4. example.com/index.php?page=great-optimized-page

Google does not know that any of those pages might be related. They’re four totally different addresses; Google has no idea that they’re all supposed to point to the same content.

If you’ve written your site as a standalone PHP application, your permalinks will look like: example.com/great-optimized-page.php. If you’ve made a static HTML site, your permalinks will look like: example.com/great-optimized-page.html. In a Drupal to WordPress migration, your Drupal site’s permalinks will look another way entirely.

Your plan is to migrate any one of these sites to WordPress, with its various forms of “pretty permalinks,” which most commonly look like example.com/great-optimized-page.

So with your migration to WordPress, every page on the site now has new permalinks, because of the change of technologies. This is true anytime you move an existing site that was using another technology onto a WordPress.

How to Tell Google About Permalink Changes

As we covered above, Google doesn’t know you’ve changed addresses unless you tell it. You have to do this to preserve your clients’ SEO. So now it’s time to learn how to actually create 301 redirects in WordPress.

The most technically savvy way to do this is through your .htaccess file, which Apache webservers use to take directives. But .htaccess rules are very technical and easy to screw up, and there’s an excellent solution that doesn’t involve nearly the same level of complexity: A free WordPress plugin called Simple 301 Redirects.

Simple 301 Redirects works great, and lets you forward traffic to another place within the same domain, or to another domain entirely, just as .htaccess rules do. You can also use wildcards to point everything at, say, domain.com/* over to a new location at domain.com/app/*.

Below is the Simple 301 Redirects screen showing a list of redirects active on our agency site, Press Up:

simple 301 redirects page

As you can see, the links in the left-hand column redirect to all kinds of addresses, on both the Press Up site itself and on WPShout. Test any of them out by navigating to pressupinc.com and then the contents of the left-hand column, and you’ll see how redirects look for a browser (and for Google).

Lastly, thanks to the outstanding (and also free) Bulk Uploader add-on for the Simple 301 Redirects plugin, you can process dozens or hundreds of redirects simultaneously by uploading a CSV file.

How to Find the Pages You Need to Redirect

The best way to diagram out the URLs you’ll need to redirect is before you move the site to WordPress: simply make an Excel document of all the permalinks on the non-WordPress site and where they should point on the WordPress site. So this would look something like: /great-optimized-page.asp > /great-optimized-page—for every page on the site.

However, if you’ve already migrated the site to WordPress, and, in the worst case, lost a record of the pages on the old site, the best way to see what Google knows about is simply to page through a Google search of the site.

That Google search will look something like this in the Google search bar: site:wpshout.com. And you’ll notice that a lot of the URLs that show up look like they belong to the old site: /great-optimized-page.asp, and so on. That’s because Google is still sending traffic to that address, even though it’s no longer current.

You should forward all the results you find using Simple 301 Redirects, another WordPress redirect plugin, or .htaccess rules. You can also actually test the effectiveness of your forwards by clicking on Google search results, and seeing whether your click finds its way to a live page on the WordPress site (good), or whether it ends up at your WordPress site’s 404 page (bad).

3. Changing Permalinks Settings on an Existing WordPress Site

When you change a WordPress site’s permalinks in Settings > Permalinks, you can open the site up to 404 errors. WordPress automatically redirects some kinds of permalinks changes, but not all kinds—and unfortunately, the rules for what changes WordPress does and doesn’t redirect are very inconsistent and don’t follow any sort of that-makes-sense-to-humans logic. I detailed many of these rules in an earlier article.

So, as that article argues, you simply can’t rely on WordPress to redirect all your permalink changes itself. When you change a site’s permalink structures (and even when you rewrite a single WordPress Page’s permalink), you’ll need to manually click around the site checking for 404s, check the old permalinks for 404s, and then patch up any 404s you do find with Simple 301 Redirects or another tool.

Redirect Yourself Toward Happiness!

Redirecting changed permalinks in WordPress doesn’t have to be especially complicated, but it’s crucial to get right. Thanks for reading, and if you have any questions or thoughts I’d love to hear them in the comments below.


5 Responses

Comments

  • Very informative article about 301 redirect…
    Thanks a lot.

  • Criação says:

    Grate article! But could you please write (a new article?) more about http to https migration and the danger of losing rankings?

  • Natasha says:

    I know I need to do this but I am NOT a technical person at all and from what I am understanding, this is something that I can NOT screw up.

    I recently had my site transferred from Bluehost to SiteGround. Which doesn’t require a redirect. Yet, I also am rebranding so I got a new domain name. I know that I must do a redirect for this.

    Is it as simple as using the Simple Redirect plugin or should I hire a professional?

  • Erez Elias says:

    Excellent article!
    Very informative.
    Thanks for sharing