Learn About 301 Redirects – Digital Marketing Madness

John Maher McDougall InteractiveJohn Maher:  Hi, I’m John Maher, and this is Digital Marketing Madness. This podcast is brought to you by McDougall Interactive. We’re a digital marketing agency in Danvers, Massachusetts.

Today my guest is Rick Floyd, senior Web marketing strategist. We’ll be discussing 301 redirects. Welcome, Rick.


Rick Floyd McDougall InteractiveRick Floyd:  Hi, John, nice to be in the studio today.


John Maher McDougall InteractiveJohn:  Rick, what is a 301 redirect?


Rick Floyd McDougall InteractiveRick:  301 is just a status code. It’s basically something that — when somebody goes to a website, let’s say the website is working fine, what the browser is seeing behind the scenes is a status code of 200, which means, “The page has been found.” A lot of people may know of 404, which means “not found,” so a 301…


John Maher McDougall InteractiveJohn:  When you go to a page and it gives you that message that says, “Sorry, we can’t find this page,” or something like that, it’s a 404 error.


Rick Floyd McDougall InteractiveRick:  Sometimes, you’ll see that they’ve made a custom 404 page that says, “This page is a 404.” Sometimes you won’t see anything, but still, to the browser, to Google, to computers, it’s a 404. It means it’s not found.

There are other error codes. 500 is a server error. There are 302s. I don’t want to go too deep into that, because that’s not what we’re talking about today.


John Maher McDougall InteractiveJohn:  301s are what?


Rick Floyd McDougall InteractiveRick:  A 301 redirect is basically a search engine‑friendly redirect. The reason you would use a 301 redirect or put one in place is, you have moved the location of a Web page. The URL, the address of your Web page has moved.

Let’s say my website is mcdougallintervactive.com/seo, and I decide to make the URL of that page mcdougallinteractive.com/seotechniques; if I don’t tell Google and anyone else that’s coming to that page that it’s moved, they’re going to get a 404, it’s not found. If Google sees a 404, they’re going to remove that page from their index.

Maybe I’ve done a lot of work with SEO to get that page to be on the first page of Google search results for my targeted keywords. If that page is not found by Google, they may drop it, so we’re being friendly to the search engines by putting into place, a way of saying, “This page has moved permanently.” That’s really what a 301 redirect is.


John Maher McDougall InteractiveJohn:  That’s what the 301 is. A 302 a moved — it’s a redirect, but it’s temporary.


Rick Floyd McDougall InteractiveRick:  Temporary. Let’s say you’re rebuilding a site, and you want to redirect to another page, just while your site’s being built, and then it’s going to come back to the original page.

A 301, you’re saying, “This page is never going to be at this address again,” and we want, not only when you visit the page will the browser read that code, the user wouldn’t even see it; you would just see the new URL. To Google, Google goes to that page, it’s not there, and it goes, “Oh, there’s a 301 redirect; this is the new URL.” It’ll read it. It’ll keep that page indexed. You won’t, hopefully, lose any SEO “juice” that you have with the page.


John Maher McDougall InteractiveJohn:  What you’re getting at here is that if you have — as we all know that Google pays a lot of attention to backlinks or links going to your site, and that’s one of the many things that’s in the Google algorithm that determines where your page is going to rank compared to other pages — when you get links going to a page, if you then just change that URL to a different URL and you don’t tell Google that you’ve changed that page, all of those links that you have going to the old page are just going to disappear. They dead-end into nowhere.

By doing the 301 redirect, you’re telling Google, “The new page is over here.” Like you said, that link juice that you’re getting to the old page will pass through that 301 redirect to that new page, and you should get, basically, the same amount of credit for those backlinks on that new page now, because you’ve set up that 301.


Rick Floyd McDougall InteractiveRick:  It’s very important for a lot of reasons. If you have a website that never was ranked in Google and you want to change all the URLs and change where the pages are, it probably doesn’t matter.

Like you said, not only might you have rankings for that page that you don’t want to lose for certain keyword searches, you might have incoming links. If you’ve done a really good job at SEO and you change the URL, the address of a page, and you don’t 301 redirect, you’re going to lose it all. They’re very important.


John Maher McDougall InteractiveJohn:  Aside from just the link juice or the power of those links going to the old pages, you actually have those links. Hopefully, you have links from really good, high‑quality sites that people are actually going to your site through. You got a link from the “Huffington Post” or something like that; if you don’t 301 redirect to that old page, all of a sudden somebody clicks from the Huffington Post to your site and they land on a 404 ‑ File Not Found error — you don’t want that to happen.


Rick Floyd McDougall InteractiveRick:  It’s a little bit akin to if you move and you don’t put a forwarding address into the post office. They don’t know where to find you. If you move your Web page and you don’t put a 301 redirect in, Google and anyone else who may have linked to your page won’t know where to find you.


John Maher McDougall InteractiveJohn:  Are there different requirements depending on my website hosting and how my website is built?


Rick Floyd McDougall InteractiveRick:  Yes. We’ll get into a little bit as we go along here about how 301 redirects are implemented. We don’t have the time today to really dig down into it. Essentially, there are two main website hosting setups, Microsoft Windows, which is also known as IIS, Internet Information Server, and then Unix or Apache servers. There are two different files that you put on your website where you place your 301 redirects.

I’m also going to mention in a second, a little bit about WordPress, because WordPress is such a popular content management system across the Web. There are ways to handle it within WordPress that automatically write these files for you.

The more popular server is definitely the Unix and Apache servers. There’s a file that lives in the root of your website, right where your home page lives on your Web server, called .htaccess — very powerful little file, you can control a lot of things with it. Essentially, you put a line in .htaccess saying, “This URL 301 redirect to this URL.” It’s a little more involved than that. There are a lot of resources on the Web that you can look up to find out more about that…


John Maher McDougall InteractiveJohn:  If I’m right, that’s actually an .htaccess file. That’s what it’s named, is .htaccess. It doesn’t actually have a file name, it just has that .htaccess extension on the end of it. Sometimes, when you’re looking in the root directory of your files, if you ftp into your site, usually you’ll see it right at the top of the list there because that dot comes first. You can download that, and you can edit it with just a Notepad document or program on your computer, right?


Rick Floyd McDougall InteractiveRick:  Yeah. A JPEG, an image file, is filename.jpeg, so .htaccess is a little strange. It’s just dot…


John Maher McDougall InteractiveJohn:  Blank.htaccess


Rick Floyd McDougall InteractiveRick: …htaccess. Sometimes if you try to open that in Notepad or a text editor, it’ll say it doesn’t understand how to open it, and you have to basically tell it, “Yes, this is a text file. Open it, so I can just read it and edit it.”

Then on IIS, Windows servers, it’s all handled in something called the web.config file. Similar method. That file lives on your server. Google knows it’s there, browsers know it’s there, and check it to see if there are any directives, both from .htaccess and web.config. It’s basically saying, “Are there any directives in here I need to follow when I load this website?”


John Maher McDougall InteractiveJohn:  I know that with Windows servers, if you have access to actually log into IIS, that you can actually set up your 301 redirects right in there as well. It’s pretty unusual unless you have your own server and you’re managing your own server. If you have shared hosting somewhere, they’re not going to let you get into the actual IIS server and make some changes there.


Rick Floyd McDougall InteractiveRick:  Correct. Quite often, unless you are knowledgeable about this stuff, either your digital marketing agency or person or webmaster, or possibly your host will set this up for you if you need it done.


John Maher McDougall InteractiveJohn:  It’s definitely a little bit more complicated on Windows servers than it is on Apache servers for sure.

You mentioned WordPress. Do you want to talk a little bit about WordPress since that is a very popular content management system?


Rick Floyd McDougall InteractiveRick:  Yeah, WordPress, basically, has things called plugins, which can do any number of things. They can run your forums, they can handle images — there is a very popular plugin on WordPress simply called Redirection. It makes it really easy, because you just open up Redirection, and you say, “I want to make a new 301 redirect.” You put in the address of the old page or the old address, and then you put in the address of the new page, and say, “Save,” and it writes a 301 redirect to whatever system you’re on.


John Maher McDougall InteractiveJohn:  Does it just basically use the .htaccess file, but it just writes to it without you having to actually open up the .htaccess file?


Rick Floyd McDougall InteractiveRick:  Correct, yes.


John Maher McDougall InteractiveJohn:  What about handling bulk redirects? For example, if I don’t just have one page that I’ve changed from this address to this address, but maybe I’ve completely rebuilt my entire website and I’m launching my new website and all of the URLs on the new website have changed, how do I go about — maybe I have 300 pages on my old site. I don’t want to have to go and set up 300 different redirects. How do I handle that?


Rick Floyd McDougall InteractiveRick:  It could be even more than that. I looked at a site earlier this year that had thousands of them. To one‑by‑one edit those is obviously very time consuming. It really depends on how things are set up, but there is something called regex.

Regex is basically a series of symbols that – they include things like wildcards. If you’re familiar with filename wildcards, you can search for a file on your computer by saying — let’s say you know the file has the name “dog” in it. You can say, “Search for ‘dog.*” That’s telling the computer to find anything that’s “dog.anything”. Regex is sort of similar. It’s way too complicated to go into a full explanation of what it is.


John Maher McDougall InteractiveJohn:  It stands for regular expressions. Like you said, it’s a way to add in little wildcard symbols here so that you’re gathering a group of pages based on some certain criteria that you’re putting into the regex code.


Rick Floyd McDougall InteractiveRick:  Correct. Very similar to the filename, a dot symbol and a star symbol are both regex characters, regular expression characters. Let’s say I have PDFs. I have a filename of menu.pdf, and it’s under a directory called “PDF.” My website is website.com/pdf/menu.pdf, but then I have a lot of other PDFs. I have “menu,” I have whatever they would be named; I have a lot of other files, and I’m going to change, in my new website, that PDF part of that URL.

Mywebsite.com/pdf, I’m going to change that to “documents” instead. Rather than redirect every single full URL to each PDF, I can say, with a regular expression, take anything that’s “PDF/anything” and change it to “documents/anything.”


John Maher McDougall InteractiveJohn:  That “anything” at the end, it just stays the same. If it’s menu.pdf at the end, it’ll stay menu.pdf, but you’re taking the part before that, before the slash, the folder “PDF,” and changing it to the folder “documents,” but keeping what comes after that the same.


Rick Floyd McDougall InteractiveRick:  Instead of saying, “I’m going to redirect/pdf/menu.pdf,” the regex might look like an up arrow, which basically means, “Only start the URL with this.” If you have a URL that’s — let’s say, if I’m a restaurant, so restaurant/pdf, that won’t work. If I put that up arrow, it’s saying, “The first thing after the domain name has to be PDF.”

So the regex looks like up arrow/pdf/.*, which means anything that begins expressly with PDF after the domain name, that’s the up arrow, includes the PDF folder, and includes anything after it — change all of those to documents, and then…


John Maher McDougall InteractiveJohn:  It’s a way to make global changes and redirects on your site without having, like you said, to do every single page individually.


Rick Floyd McDougall InteractiveRick:  Correct. Like I said, it is fairly complicated. It’s extremely powerful. If you do a lot of this type of work, it really behooves you to learn something about it. There’s a great resource online called regexr.com. It’s R‑E‑G‑E‑X‑R.com. It’s easily found on Google if you type in “regular expressions.”

The reason it’s great is, it’s a regex testing tool. If I’m writing them, I can actually put them in and see what the output of my regex will be. I can look at it and try to figure out if this is correct. Am I writing the regex correctly? Am I getting the result I want? If you’re a beginner, it has links to all kinds of resources, help files, introductions, so it’s useful if you’re just starting out and if you know regex inside out and you just need a testing tool.


John Maher McDougall InteractiveJohn:  Say I’ve set up a bunch of 301 redirects, and I want to test to see whether or not they’re working, how can I test to see whether the redirects have been successfully applied?


Rick Floyd McDougall InteractiveRick:  There are a number of things called header checker tools, and what these simply are — it’s a website. If you type in “header checker tools” in Google, you’ll get a list. We use one called internetmarketingninjas.com.

I want to test my 301 redirects. I know what my old URL, what my address of my page was; I’m going to put it into that tool and simply press “Check,” and it’s going to tell me what status code the browser’s seeing. If I didn’t do the redirect correctly, I might see a “200 OK,” meaning it found it where it was supposed to be. That’s not what I want.

If I did, what you’ll see underneath it is “301 Moved Permanently,” and then “200 Status OK.” It’s saying, “I went to this URL, I saw 301. It told me the page moved. Here’s where it moved to,” and that’s what you want to see.


John Maher McDougall InteractiveJohn:  You can go to Google and search for “HTTP header checker tool” or something like that, and find a number of these different tools, but like you said, you just put in a URL and it walks you through. You can see the behind the scenes, step‑by‑step process of what is showing up in that header, behind the scenes, in the background when one of those pages is loading.

Like you said, you’ll see the old URL, you’ll see that there was a 301 going to the new URL, and then you’ll see “‘200 OK.’ We’ve found the final page.”


Rick Floyd McDougall InteractiveRick:  Correct. One of the things that can happen, let’s say I have multiple people working on a website and somebody else applies a redirect to something they’re working on, I apply one to something I’m working on, and we don’t communicate, you can end up with what’s called a redirect loop, which is just like it sounds.

Basically, I’m saying, “If you go to this URL, 301 redirect to this URL.” Someone else has put a redirect on that that redirects it back to the first page, and so your browser actually just starts going around and around. It’s redirecting, redirecting.


John Maher McDougall InteractiveJohn:  It can recognize that it’s in a never‑ending loop, and it will break. It won’t show you the page, because there’s nothing for it to show. It’ll just say, “Redirect Loop,” and that’s all you’ll see on the page, so you have to be careful about that.


Rick Floyd McDougall InteractiveRick:  Correct. That’s just as bad as not having a 301 redirect. Google will say, “This page doesn’t work. I’m going to drop it from my index,” and/or your incoming links won’t work. A header checker tool will show you that. You’ll see, “301, 200, 301, 200, 300, 200.” It will just keep going. Some of the header checker tools will just say, “This page has a redirect loop.”


John Maher McDougall InteractiveJohn:  Are there any other ways to test your redirects?


Rick Floyd McDougall InteractiveRick:  Not so much test, but Google Webmaster Tools, which if you have a Google account, you have, you just have to enable it; it has a section under their Crawl section and the subpart of that. It’s Crawl, Crawl Errors. Crawl Errors will tell you, basically, “Google has this page in its index,” or “Google saw a link to this page from somewhere else, tried to go there, couldn’t find it.” Those are crawl errors.

Let’s say you got a new website, you did a bunch of 301 redirects, and you want to monitor whether you did them all, whether you caught them all. Quite often if it’s a really huge website, it’s very hard to make sure you got them all.


John Maher McDougall InteractiveJohn:  You miss some.


Rick Floyd McDougall InteractiveRick:  If you monitor your crawl errors in Google Webmaster Tools, you’ll see those pop up one by one. You can look at them. If you click on them, Google Webmaster Tools will tell you where that page was linked from; how did Google try to find this page.

You can start to see why it’s not being found, or you can simply say, “This page absolutely needs to redirect. I have this page in my new website, but it’s a different address. I guess I must not have redirected it. I need to apply a 301 redirect.


John Maher McDougall InteractiveJohn:  You basically are using Google’s crawler as a tool to allow you to find errors on your website. If you find those errors, obviously, you want to correct those, so you can apply some more 301 redirects as needed in order to clear up all of those errors.


Rick Floyd McDougall InteractiveRick:  Again, if I’m just going to redirect one page and I want to see if it works, a header checker tool is fine, because I could just type it in. It either works or it doesn’t. If I have a much bigger project, that becomes time consuming too; to check them one by one, so I just monitor my Google crawlers.


John Maher McDougall InteractiveJohn:  That’s excellent information, Rick. I appreciate you talking to me.


Rick Floyd McDougall InteractiveRick:  Thank you very much, John.


John Maher McDougall InteractiveJohn:  For more information about digital marketing, visit mcdougallinteractive.com, and subscribe to this podcast on iTunes. We’ll see you next time on Digital Marketing Madness.

 

0 replies

Leave a Comment!

Leave a Reply

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