Editor’s Note: This blog post originally appeared on May 6, 2013. It has been updated to reflect offering changes, as well as newly available tools and solutions.

Are you moving your website to a new domain? Are you keeping the same domain, but changing your URL structure? In many cases, a 301-redirect is the best way to tell users and search engines, “Hey! The content you were looking for on this URL is now permanently moved over to this new URL. I still want all the credit and influence that I’ve built up, so send that along as well!”

There are certainly other ways to redirect users and search engines, but the 301-redirect is the best way to retain and redirect the SEO influence that you’ve worked so hard to build.

This post will give a short overview of 301-redirects, then walk through the most common ways to implement a 301-redirect on your website

What is a 301 Redirect?

A 301 redirect, as the name suggests, is a method of redirecting traffic from one URL to another.

For example, you may own two URLs such as “yourcompany.com” and “yourcompany.net.” In this scenario, “yourcompany.com” is your selected primary site because there can only be one. In addition, you registered yourcompany.net to prevent competitors from taking advantage of its brand and goodwill. In this case, you implemented a redirect to forward traffic from yourcompany.net to yourcompany.com. Now, when a user types “yourcompany.net” into the web address of a browser, the user will successfully get taken to yourcompany.com.

A 301 redirect is one of the most efficient and search engine friendly type of redirects. The “301” number signifies that the redirection is permanent for Google and other search engines to recognize and crawl.

Why Use a 301 Redirect?

A 301 redirect is used to permanently redirect from an old URL to a new URL. There are several SEO benefits to utilizing a 301 redirect as highlighted below:

  • Allows you to send to one preferred URL from multiple URLs.
  • Enables a seamless transition.
  • Protects your website backlinks because all current backlinks from the old site are attributed to the new site.
  • Allows web pages in the new site to be indexed easily.
  • Minimal negative impact in user traffic.

Process to Set-Up a 301 Redirect

The process to set-up of a 301 redirect varies with the nature of your website. Below are some instructions to redirect PHP sites. Remember, be sure to create a backup of the original file just in case.

We have illustrated how to compile a 301 redirect through both .htaccess and CPanel.

PHP Sites

  1. To begin setting up a 301 redirect for your PHP site, log into the FTP account for the website.
  2. Open the Index.php file from your root directory.
  3. Replace the contents with the following code:

<?php

header(“HTTP/1.1 301 Moved Permanently”);

header(“Location: <http://example.com/new-location>”);

exit();

?>

This snippet can also be consolidated into the following, single line:

<?php header(“Location: http://example.com/new-location”, true, 301); ?>

.htaccess approach

You can also complete the 301 redirect by using the .htaccess file. Please note this approach is typically targeted for advanced users and needs to be accurately completed for it to work correctly.

  1. To start modifying your .htaccess file, log into the FTP account.
  2. Open the .htaccess file from your root directory.
  3. Replace the contents with the following code:

This code redirects your entire website to any other domain.

redirect 301 /old-page/url-path.html   http://example.com/new-page/url-path.html

Important Note: Make sure the contents of the modified file is completely cleared prior to pasting the new code. As a reminder, we advise you to backup the original file should you come across an issue in completing the redirect. This allows you to retry and complete the process correctly if needed.

Using CPanel

You can also add a redirect by accessing the CPanel and following the steps outlined below.

  1. Log into your cPanel and enter the domain section.
  2. Click on the option for a redirect.
  3. Select the URL you want to redirect, insert the new URL, and then confirm the changes. Carefully check your work to ensure it’s correct.

Please note the interface of the CPanel will vary based on the software used.

Congratulations, you can now be rest assured that your old URL will point accurately to your designated new URL for visitors and search engines alike.

Some Best Practices for 301 Redirects.

Using the steps outlined above, you’ve hopefully enhanced your website to become more search engine friendly and increased its ability to rank higher in Google. Here are some top tips to creating 301 redirects:

  • Test out the 301 redirect. Make the that the redirect is working correctly. This strategy will inform Google and other search engines that the URL has been permanently moved, and it can be indexed.
  • Display quality content on the new page as soon as possible.
  • When redesigning your site, move your content first and then redesign the site. This strategy will make it easier to manage and troubleshoot.
  • Submit your new site to Google Search Console to confirm ownership. This important step notifies Google that your new site is available and is the preferred version of your domain.
  • Keep both sites verified in Webmaster Tools, which will help you check for crawl errors. This ensure that the redirect from the old site is working properly and prevents “page not found” errors in the new site.

Need further help with technical and on-site SEO? Check out UpCity’s reseller services. Our team of experts will take care of every aspect of the client’s project on your behalf.

Looking for more SEO assistance for your business? Find great SEO partners in our Top Local Agency Marketplace!

Jack Thornburg
Director of Services at UpCity | More Posts

As Director of Services & Customer Success at UpCity, Jack has led SEO and Social Media campaigns at both the local and national level. He understands the importance of a balanced, data-driven inbound marketing strategy and enjoys witnessing the benefits of this approach for clients. Outside of work, Jack can be found sipping good coffee, riding his bike, or testing out ways to do both at the same time.