Do You Even 301, Bro?

If we’re being really honest, writing 301 redirects is boring. Alright, it downright sucks. Knowing differences between  301 redirects and 302 redirects is kinda important. But, writing redirects isn’t nearly as bad as losing all the SEO value of pages that Google and other search engines have already indexed!

This post is here to make writing 301’s suck a little less and to help you come up with a decent redirect strategy for the website you’re working on.

First, let’s define the difference between a 301 and a 302, just to make sure we’re all on the same (web)page.

301 redirects and 302 redirects
Source: Moz.
  • A 301 redirect will send visitors and search engines to the new destination permanently.
  • A 302 is a temporary redirect that indicates you only want visitors to be sent to a different page for a short period of time.

*Google has said that both 302 and 301 redirects both pass PageRank, but there is a debate within the SEO community. Use a redirect based on their intended purpose so you don’t cause problems later. If you want a permanent solution, use a 301; if you want a temporary solution, use a 302.

Pretty simple, right? Cool. Let’s move on.

301 redirects and 302 Redirects Requirements

Get a List of All Existing Pages

First, we need to get a list of every page on the production site.

  1. Configure Screaming Frog to crawl internal links only. You’ll also want to turn off screenshots/rendering so you don’t waste time crawling a bunch of crap on a website you don’t care about.
    • You should choose a spot to keep your Screaming Frog configurations and extract the file there.
    • You can load the configuration in Screaming Frog under “File > Configuration > Load Configuration”.
  2. Once you’ve got Screaming Frog configured, type in the production URL and let the site crawl begin.
  3. Once the crawl is finished, save the results (“File > Save”) This is important. Should you find yourself needing a list of every page that did exist on a site, you can Load this crawl data.
  4. Filter the results down to Internal HTML pages only.
    • You can do this via the “right sidebar”, under “Internal > HTML”.
  5. Highlight every single address listed in the results and copy (CMD+C).
  6. Paste the copied addresses into your text editor.

Crawl the Resulting Addresses on the Sandbox

Next, it’s time to crawl all the resulting addresses. Here at TM, we set up a sandbox website where we get to play around before pushing everything live. If we break something, no harm no foul – it wasn’t on the live site!

  1. Run a “Find/Replace” to replace the production address with the sandbox address.
    1. In this example, we would replace “www.example.com” with “example.tmsandbox.com”.
  2. Select & copy all of the new sandbox URLs (CMD + A & CMD + C).
  3. Back to Screaming Frog & clear the current crawl results.
  4. Click “Mode > List” in the Screaming Frog menu bar.
  5. Click Upload where the address bar used to be, then select “Enter Manually”.
  6. Paste the copied sandbox URLs and begin the crawl.

Evaluate the Results

  1. At this point, you know what pages require a 301 redirect if they return a 404 response*.
  2. You can apply a filter to only show 404 pages in the right sidebar under “Response Codes > Client Error”.
  3. Similar to the first step, copy the addresses of all the 404 pages and paste them into a text editor.
  4. This time run a find/replace to remove the request protocol and sandbox domain name altogether.
    • In this example, we would replace “http://example.tmsandbox.com” with an empty string.

*A 404 is an error message displayed by a browser indicating that an Internet address cannot be found.

Write the 301 Redirects

With a list of URL’s that will 404 on the new site, you’re ready to start writing the 301 redirects. In this next step, you’ll use Google Docs, because it’s stupidly easy. It’s how we do it here at TM.

  1. Open Google Docs & login with your Google account.
  2. Go to Google Sheets.
  3. Create a new spreadsheet from the “301 Redirect Template”.
  4. Paste all the paths from your text document into the spreadsheets first column under the Source URL.
  5. Enter a relative rewrite path to in the 2nd column.
  6. Once you have provided a rewrite path for each URL, click File > Download As… > CSV.

Import the Redirects

  1. Log into the WordPress admin.
  2. Make sure Redirection is activated.
  3. Go to Tools > Redirection.
  4. Toward the bottom, you’ll see “Import”.
  5. Choose the File & then click Upload.

Test the Redirects

Lastly, you just need to make sure the work you’ve done is working.

  1. Return to Screaming Frog. You should still have the sandbox crawl results filtered to only show 404 response codes.
  2. Highlight all the visible results, right-click and select “Recrawl”.
  3. Addresses that disappear from the 404 list have successfully redirected.
  4. Any results that do not disappear were not redirected correctly.
  5. Crawl the entire sandbox once more, to ensure there are no 404 response codes.

If there no 404’s, all addresses were successfully redirected.

Congratulations! You are now a master of 301 redirects and 302 redirects! Now you should learn more about what’s in an SEO audit and howto apply all this awesome redirect knowledge!

Leave a Reply

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

Read Related Posts