Fix 301 Redirects For SEO [Tactic Tuesday]

on under SEO Auditing, Tactic Tuesday.

Every time a link passes through a redirect, PageRank is lost through a piece of Google’s algorithm called the “damping factor.” In practice, this means that any time you link to yourself, you want to link directly to the target page, not to a URL that redirects.

Here’s how to do that, if your site runs on WordPress.

1. Get Screaming Frog

Get it here. Download it, follow the instructions to install it, yadda yadda. You know the drill.

2. Crawl Your Site

Once Screaming Frog is up and running, type in your site name and hit “Start.”

screaming frog crawl

Wait for Screaming Frog to crawl the URLs on your site. This will be indicated by the status bar:

progress bar

Wait for it to reach 100%.

3. Export The 301 Redirects

Set the “Filter” to “HTML.” Sort the URLs by clicking on the “Status Code” column heading so that the arrow points downward (for descending):

sort status codes

Highlight the addresses with a 301 status code, copy them (ctrl+c), and paste (ctrl+v) them into your favorite spreadsheet software (Google Sheets or Excel, for most), under a column called “301 URLs.”

copy 301s

paste to spreadsheet

4. Add The Correct Links To The Spreadsheet

 

The easiest method for me is to simply copy the URL from the spreadsheet, paste it into my browser of choice, then copy the final URL after it finishes redirecting. I paste it into a column called “Redirects To.” (Copying the destination URL from Screaming Frog can cause you to miss the fact that the URL it redirects to is broken, or another redirect.)

destination URLs

5. Install the “Better Search Replace” WordPress plugin

Log into WordPress and go to Plugins > Add New

add new plugin

Search for the plugin:

search for plugin

Click install:

install better search replace

And activate:

activate better search replace

6. Search And Replace The Redirected URLs

Backing up your database before this step is advised.

Go to Tools > Better Search Replace

better search replace menu

Now copy the “301 URLs” from your spreadsheet into “Search for,” and the “Redirects To” URLs into “Replace with.” You will need to do one replacement at a time, you can’t copy whole columns. Select the tables where the links are located (typically wp_posts), and make sure “Run as dry run?” is unchecked. Then press “Run Search/Replace.”

IMPORTANT: Do NOT perform replacement that includes the search string in its entirety. For example, don’t search “http://example.com” and replace it with “http://example.com/”. Doing so will perform that replacement, but will also replace “http://example.com/” with “http://example.com//”. These types of replacements must be made manually.

run search replace

Repeat this for each URL. After the last search and replace is finished, you should be all set. You can run Screaming Frog a second time to ensure the 301s were fixed.

All set.

  •  
  •  
  •  
  •  
  •