I moved five times in the last year. And every single time I moved, I forgot to sign up to have my mail forwarded to my new address.

Mail forwarding is an important step in any moving process, as it ensures you don’t lose any valuable information that’s sent to you.

And the same can be said for your website: If you’re moving a website from one URL to another, you need to take the necessary steps to ensure your visitors get sent to the right place. In the world of tech, this is called a 301 redirect.

A 301 redirect is key to maintaining a website’s domain authority and search rankings when the site’s URL is changed for any reason. It easily sends visitors and search engines to a different URL than the one they originally requested — without having to actually type in a different URL.

Let’s put it into practice. Below are two different URLs that take you to the same site. That’s thanks to a 301 redirect. That way, when people link to HubSpot Blogs using either URL, the URL we direct blog traffic to (blog.hubspot.com) retains the search engine authority associated with inbound links to either URL.

  1. blog.hubspot.com
  2. http://blog.hubspot.com

Did you notice that even though the second link has “http://” at the beginning of the URL, by the time you arrived at the blog, the URL in your browser read “blog.hubspot.com“? That’s because of a 301 redirect. It’s essential to set this up so the domain authority from inbound links to the http:// address are linked to blog.hubspot.com to improve its search rankings.

1. Implement the code.

First, you’ll want to open a fresh new document or a text editor. After this, write this line of code, exchanging “yourwebsite” with your actual domain. 

Redirect 301 / http://www.yourwebsite.com/

2. Save and upload the file. 

Next, save this file as .htaccess and upload it to your website. And if you’re using the .htaccess only method, you’re done! 

If, however, you’re redirecting a URL to a non-URL, there’s a different codebase to be used. 

3. Implement the www code.

After you open your text editor, instead of saving the file as an .htaccess file, write or copy this line of code, exchanging “yourwebsite” with your actual domain. 

Options +FollowSymLinks

RewriteEngine on

RewriteCond %{HTTP_HOST} .

RewriteCond %{HTTP_HOST} !^yourwebsite.com

RewriteRule (.*) http://yourwebsite.com/$1 [R=301,L]

4. Save this file.

Just like if you were implementing redirects using just an .htaccess, in this step you’ll also save the file as such and upload it to your webpage. And there you have it — a brand new, shiny, 301 redirect.

Why Set Up a 301 Redirect?

The big reasons marketers might set up a 301 redirect are:

1. Associate common web conventions (http://, www., etc.) with one URL to maximize domain authority.

Like the scenario above, 301 redirects are extremely helpful in making sure your SEO is as accurate as possible. This is also helpful in content migration; it helps audiences and search engines find your website faster.

2. Rebrand or rename a website with a different URL.

When a brand is changing its company or website name, a 301 redirect is integral to maintaining the power of
inbound links to the original URL on the migrated new domain. Additionally, the 301 redirect is necessary in this case to do exactly what redirect means — to send website visitors to the right web address to get what they’re looking for.

3. Direct traffic to a website from other URLs owned by the same organization.

Brands sometimes purchase domains that are similar in name or subject matter to their brand to generate more search traffic to their website. A 301 redirect is necessary to make certain that the brand’s original domain maintains its search authority in the process.  

4. Quick fixes.

Let’s say you accidentally make a small mistake on a blog post or subscriber email and you post a broken link. We’re human, it happens. To remedy this, adding a redirect line in the .htaccess file will do the job for you.

5. Ad tracking.

Redirects have a marketing benefit, as well. If you run banner ads, you can track responses to them by using URLs in those ads. By implementing a redirect, the traffic you gain from that ad is potential traffic you can earn from that URL. 

Generally speaking, a 301 permanent redirect is better for search engine optimization than a temporary redirect because it transfers the inbound links from the redirected domain to the new one, which helps the website maintain its search rankings and prevent any dip in search traffic.

There are few situations where a 302 temporary redirect would be preferable over a 301 permanent redirect — except for when website content needs to be moved temporarily, such as when a site is undergoing maintenance and visitors need to be directed to a different domain to consume their content.

301 Redirect Mistakes to Avoid

Now that you understand the importance of the 301 redirect, we’ll review common steps in the process to review to make sure you don’t make a mistake that could adversely impact your site’s SEO.

1. Setting up a 302 redirect between versions of your domains.

301 redirects point the power of inbound links from one URL to another, and although it might not look like it, http://blog.hubspot.com and blog.hubspot.com are two different URLs. Make sure you set up a 301 redirect from all of the different iterations of your brand’s domain to boost your search engine results.

2. Setting up a 301 redirect after creating a new page.

Back in 2010, Toys ‘R Us purchased the toys.com domain without setting up a 301 redirect first, and their new site’s SEO results plummeted because it was re-crawled by Google as a brand-new domain without inbound links from the original Toys ‘R Us domain pointing to it. Be sure to set up the 301 redirect before migrating your website content so your site doesn’t lose traffic in the process.

3. Using a 302 redirect during content migration.

Unless you’re temporarily migrating your website’s content while updating or repairing your website, use a 301 redirect to maintain the inbound links and your search rankings while making changes to your domain.

4. Having redirects link to outdated content.

If you don’t set up redirects from the older internal links on your website (such as a link to your company blog on your homepage), you’ll create a bad user experience for site visitors who click on these older, not-directed links. The old internal link will eventually kick over to the new domain, but it might take several seconds or show a white screen in the meantime.

The good news is that it’s easy to set up a 301 redirect correctly following the steps above and if you’re using HubSpot software to optimize your website. We wish you the best of luck with your next website redirect and moving process. (P.S. – We can help with one of those.)

5. Redirect a page with a different intent than the destination page.

This will be a breeze with proper organization and record keeping, but make sure that you’re redirecting to the correct pages. To illustrate, you wouldn’t want to redirect a user looking for your homepage to your blog page.

Keeping this transition smooth will contribute to SEO being accurate, and will lead to more happy visitors to your site.

Whether you’re thinking about overhauling all content in a site migration, or you’re just refurbishing some outdated webpages, 301 redirects help. If you’re planning out this new stage, think about incorporating them in your project; your SEO won’t take a dive and website visitors will continue to find the helpful content they’re looking for.

Editor’s Note: This post was originally published in December 2010 and has been updated for accuracy and comprehensiveness.