301 Redirect Guide: An Introduction

301 Redirect Guide

What Is A 301 Redirect?

A 301 redirect is the HTTP status code to indicate that a site moved permanently to another domain. Surely you’ve seen 404 pages when you’ve encountered a broken link, or you’ve seen a 503 code when the server is unavailable. The 301 redirect is one of the most paramount things you can do for your site, but it’s also one of the easiest to overlook.

Why Use A 301 Over A 302?

It is essential to know the difference between 301 redirects and 302 redirects. As I mentioned at the beginning of this article, the 301 redirect is permanent. The 302 redirect is a temporary redirect. This may mean nothing to you – fair enough. But it’s important because a 301 redirect passes on link authority to the page that it’s redirecting to, while a 302 does not. You obviously want to pass the rankings along to your new site or your subdomain, otherwise all the hard work you put into your old domain will be lost.

When To Use A 301

Did you have a site from when you were younger that you may have grown out of, but you’ve still got pages that rank that you don’t want to get rid of? Did you pull an SEOMoz.org to Moz.com? Or did you just want to pass rank along from your domain to your oft-linked-to www subdomain? If you answered “yes” or “maybe” to any of those questions then a 301 redirect is the right choice for you. Search engines treat domain.com and www.domain.com as two different domains essentially, which can become a disaster when you’re trying to get your pages to rank and your backlinks are spread out all over the place! Another note is that a search engine will also treat the http and https version of your site differently.

How To Check If Your Site Is Redirecting

The easiest way is to type your original URL into the address bar. For example, if you’re typing in donovic.com and you see that it redirects to https://donovic.com/, then that’s an example of a 301 redirect hard at work. But maybe you’re not quite sure if  your site is redirecting properly. But have no fear! There’s this nifty tool that you can use called Internet Officer’s Redirect Checker. It’s simple enough to use, but I’ve included a couple pictures and steps on how to use the tool.

  • Enter the original URL in the box

301 redirect check

  • The “type of redirect” will tell you whether or not it’s a 301

301 redirect check response

As you’ll see, it was successful!

What To Do If Your Site Isn’t Redirecting

There’s a few different options. One is going into the back end of your site via FTP and editing your .htaccess file. Another is cPanel specific. And another is WordPress specific (assuming you use WordPress). Let’s delve into these.

Editing Your .htaccess File

A typical .htaccess file will look something like this (if you’re using WordPress):

# BEGIN WordPress
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# END WordPress

To make a redirect possible, you’ll want to add a redirect rule at the top of your .htaccess file. So your end product will look something like this:

Redirect 301 / http://www.example.com/
# BEGIN WordPress
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# END WordPress

If you want to redirect an old domain to a new domain you’ll want to edit the .htaccess on your old site, you want your redirect to look like this:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} ^oldsite.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.oldsite.com$
RewriteRule (.*)$ http://www.newsite.com/$1 [R=301,L]
</IfModule>

You’ll want to make sure that you’re redirecting specific pages to new pages on your new domain if you chose to rename them, for example:

Redirect 301 /old-page-name/ /new-page-name/

To be clear, you may end up editing the .htaccess on your old site and your new site.

Redirecting Through cPanel

Everyone’s cPanel dashboard looks different depending on what hosting provider you’re hosting with and what plan they set you up with. You’ll want to scroll down until you see a section named Domains and in that section, you’ll find an icon entitled Redirects. It should look something like this :

domains section cpanel

You’ll then arrive on a page that includes an area where you can add your redirect. You can choose whether you want to do a 301 redirect or a 302 redirect. In this case, we’re talking about a 301. You’ll want to choose the appropriate domain that you own and then make sure it redirects the way you want it to. For example: I would choose donovic.com in the **All Public Domains** drop down box. In the Redirects To box, I would type in https://donovic.com, click Add, and voila!

Through WordPress

On the left side panel, hover over Settings and click General. You’ll see a page with a bunch of general settings, but what you’re going to want to focus on are the sections where the page says WordPress Address (URL) and Site Address (URL).

If wanted my site to redirect from donovic.com to www.donovic.com, so I input the the www accordingly. (You’ll notice that the trailing slash does not appear – don’t worry about it, it will appear.)

Sometimes Errors Do Occur

If that happens, don’t panic! Take a deep breath. Perhaps you had a typo in your .htaccess file, or you run into a redirect loop via cPanel. If something just isn’t working right, perhaps it’s a hosting service problem. Make sure to contact your host’s tech support in case you skipped over something. Well, that’s all for this post! I hope this helped you out in your redirecting endeavors. If you have any questions or comments, make sure to leave them below!

Nik Donovic

Nik Donovic

When Nik isn't busy playing guitar, hiking (when the AZ weather isn't super hot), or reading, he spends his time with digital marketing and SEO. His goal is for Donovic Media to propel the positive impact of the right brands, to make the digital, and thusly, the actual world a better place.
Facebook
Twitter
LinkedIn
Email

Leave a Reply

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