The Missing Guide: 301 Redirects

Share this article

The modern web is fluid, with new pages being built and old ones being deleted on a constant basis. If you are planning to delete pages or reroute visitors from an old page or domain to a new one, this is the guide for you.

Why do I need a 301 Redirect?

301 redirects perform two major tasks: most importantly, they inform search engines that your page or site location has moved, and transfers the page rank and “link juice” from the old to the new. It’s a relatively simple solution to preserve a page or site’s hard-earned search rankings after it has moved. The second benefit is that every outstanding link or bookmark will still send visitors to the new site, so you don’t have to worry about broken links.
Note
This is strictly a guide for an .htaccess 301 Redirect, which is the most common server-side method. It is a requirement that your website be on an Apache server with Mod Rewrite turned on; most hosting companies use this, but if you aren’t sure, check with your host.
First, you need to force your computer to recognize the .htaccess file, the file we will be editing in later steps. By default, any files beginning with a “.” are hidden on most computers because they are usually sensitive operating-system files that would cause damage to the system if accidentally edited or deleted. However, we need to be able to see and edit a “.” file for our website, so here’s what you need to do:

Mac Users

1. Go to Applications>Utilities and open Terminal. With the window selected, paste the following and hit Enter. defaults write com.apple.Finder AppleShowAllFiles TRUE 2. Force Finder to relaunch by pasting the following code and hitting Enter again. killall Finder 3. When you are finished and want to hide system files again (which is generally a good idea), repeat the same steps, but replacing TRUE with FALSE. defaults write com.apple.Finder AppleShowAllFiles FALSE Then force Finder to relaunch again: killall Finder

PC Users (Windows Vista & Windows 7)

1. Launch Windows Explorer. 2. In the Organize
drop-down menu, choose Folder and Search Options. 3. Under the View tab, scroll down and check the box next to “Show hidden files and folders.” 4. To hide the files again, simply go back and uncheck the box.

Opening the .htaccess File

Now that you can actually see the file you’ll working on, go to your site’s root directory, or topmost folder. There you should find the .htaccess file. If you don’t have one, I’ll explain how to create one.

If There is No .htaccess File

Never fear, creating one will be a quick and painless: 1. Go to any basic text editor like Notepad or TextEdit, and open a new document. 2. In the first line, write the following: RewriteEngine ON 3. Go ahead and Save As, and make sure the file name is simply .htaccess, with no .txt or anything after it. If you followed the step above to allow your computer to view hidden files, this should be no problem. That’s it! You’re set up to begin the next steps.

If There is an .htaccess File

1. Download it and open it in a basic text editor like Notepad or Text Edit. 2. Ensure there is a line that reads: RewriteEngine ON If that line isn’t there, type it in on the first line. Make sure any code you add is below this line.

Adding the 301 Redirect

The next step is to add the code that will perform the redirect. While there are many types of redirect, we’re only going to look at redirecting single pages and domains. If you need a different type of redirect, a quick search should yield a snippet that you can paste in place of the below snippets.

Page to Page Redirect

To redirect from an old or deleted page on your domain to a new one, paste the following code into your .htaccess
file below the Rewrite Engine on line, replacing the information to reflect your site and page names: Redirect 301 /oldpage.html http://www.yoursite.com/newpage.html That’s it! The old or deleted page is the first item, and the full address of the new page follows.

Domain Redirect

If you changed web addresses, you’ll need to direct search engines and traffic to the new one. In this case, you’ll need to start a new blank .htaccess file and paste the following:
Options +FollowSymLinks
RewriteEngine on
RewriteRule (.*) http://www.newwebsite.com/$1 [R=301,L]
This .htaccess file will be placed on your old domain, so this will only be effective as long as the old domain stays live. It’s suggested that you keep your old website live until search engines recognize the 301 and credit the new page with rankings.  For more information on helping Google recognize your new site, I recommend this article on how to properly move domains from an SEO standpoint. In the meantime, it’s important that you contact any site or directory containing backlinks to ensure they have the new URL for your site.

Uploading and Testing

Good news—you’re almost there! Your last step is to upload the new .htaccess file to your website’s  root directory. Once that is done, be sure to test and make sure the old address redirects you to the new page or domain! Congratulations—you’re now a 301 veteran.

Frequently Asked Questions about 301 Redirects

What is the difference between a 301 redirect and other types of redirects?

A 301 redirect is a permanent redirect from one URL to another. It is the most efficient and search engine-friendly method for webpage redirection. Unlike other types of redirects such as 302 (temporary redirect), a 301 redirect passes between 90-99% of link equity (ranking power) to the redirected page. This is why it is often used when implementing new pages or sites, or when content has moved to a new location.

How does a 301 redirect affect SEO?

A 301 redirect is beneficial for maintaining a website’s domain authority and search rankings when a page’s URL changes. It ensures that users and search engines are directed to the correct page, thus preventing broken links. It also helps to consolidate link equity, which can improve the redirected page’s visibility in search engine results.

How do I implement a 301 redirect on my website?

The process of implementing a 301 redirect varies depending on your website’s server. For Apache servers, you can use the .htaccess file to input code that instructs the server to redirect one URL to another. For Windows servers, you can use the web.config file. It’s important to test your 301 redirects after implementation to ensure they are working correctly.

Can I use a 301 redirect to change my domain name?

Yes, you can use a 301 redirect to change your domain name without losing your existing SEO efforts. It allows you to maintain your search rankings and link equity from your old domain to your new one. However, it’s crucial to update all of your internal links to point to the new domain to avoid unnecessary redirection.

What are some common mistakes to avoid when implementing 301 redirects?

Some common mistakes include redirecting all old pages to the new homepage instead of their equivalent pages, failing to update internal links, and forgetting to check the redirects’ functionality. It’s also important to avoid creating redirect chains, where a URL redirects to another URL that also redirects, as this can slow down the site and negatively impact user experience.

How can I check if a 301 redirect is working correctly?

You can use various online tools to check if your 301 redirects are working correctly. These tools allow you to input your old URL to see if it successfully redirects to the new one. It’s also important to monitor your website’s traffic and search rankings after implementing redirects to ensure they are not negatively impacting your SEO.

Can I undo a 301 redirect?

While it is technically possible to undo a 301 redirect, it’s not recommended as it can cause confusion for search engines and users. If you need to change a redirect, it’s better to implement a new 301 redirect from the old URL to the new one.

How many 301 redirects can I have on my website?

There’s no limit to the number of 301 redirects you can have on your website. However, each redirect should serve a purpose and improve the user experience. Having too many unnecessary redirects can slow down your site and negatively impact your search rankings.

Do 301 redirects pass PageRank?

Yes, 301 redirects pass the majority of the PageRank from the old page to the new one. This is why they are often used in SEO when changing URLs or implementing new pages or sites.

Can 301 redirects cause a loop?

Yes, if not implemented correctly, 301 redirects can cause a loop. This happens when Page A redirects to Page B, which then redirects back to Page A. This can cause significant issues for both users and search engines, so it’s important to carefully plan and test your redirects.

Mandy BarringtonMandy Barrington
View Author

Mandy Barrington is Lead Web Designer at US-based online marketing agency RYP Marketing, where she provides web design and content development for clients ranging from local businesses to international corporations.

301 redirect
Share this article
Read Next
Get the freshest news and resources for developers, designers and digital creators in your inbox each week