301 Redirects Explained

How can I minimize the loss of traffic to my site after I change a domain name?

This week’s question for our “Ask a SEO Expert” comes from Ester Brown who is a member of our Phoenix SEO and Internet Marketing Meetup.

Ester’s company is changing the name of their company, thus they also want to change their domain name to reflect their new brand. Ester’s company’s site was first launched in 2002 and has several hundreds of links pointing to it. She is concerned that once her company goes live with the new domain and website that they will lose traffic.

Set Up a Permanent 301 Redirect

Ester, in root area of your website there is a file called .htaccess

This file is a simple plain text file that you can edit with any text editor such as Notepad.

Think of this file as being a traffic cop which can detour traffic for a page, a directory or in your case an entire website.

Precautionary Note:

If there is an existing .htaccess file, make a back-up of it in case something goes wrong so you can restore the old one.


Redirecting a Single Page

The easiest example to start with is redirecting, or forwarding, one page to another. This could be because you changed the page name, you removed it, or you moved to another domain.

By adding a single line to the .htaccess file, you can redirect any visitor to the new version of a page. The syntax for a single page is:

Redirect 301 /oldpage.html http://www.domain.com/newpage.html

To break it down, we have:

  • Redirect: The command
  • 301: The type of redirect,
  • /oldpage.html: The old page ‘without’ the http://www.domain.com,
  • http://www.domain.com/newpage.html: and the full URL of the page we want to redirect to.

It typically takes a few weeks for the search engines to update your listing for this page in their index.


Redirecting an Entire Domain To a New One

You can also do this for an entire domain to a different one using the code in the following example:

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

In this example we are redirecting anything that comes in to this website to the homepage of a different domain. This is not advisable, and is only done under certain circumstances.
Examples: An alternate spelling of a domain redirecting to the correct one, or redirecting .net to .com when there was never anything on the .net domain.


Redirecting With Dynamic Matching

Ester since you are moving from one domain to another, and may be keeping all the pages named exactly the same there is third option: RedirectMatch.

With RedirectMatch we can dynamically direct one page to another based on some dynamic criteria.


Example 1:

RedirectMatch 301 /(.*)$ http://www.newdomain.com/$1

The simple break down: Redirect 301 (this page) to the new domain with (the same page name).

A further breakdown:

(.*) is used to turn the pagename into a variable $1. The $ (dollar sign) after the function means “the pagename ends here”, this will need a few more examples to be fully clear.


Example 2:

RedirectMatch 301 /blue-widget-(.*).html$ http://www.newdomain.com/bluewidget-$1/

If our original page is /blue-widget-34.html the new URL will be:

We are just turning that one portion, the part number ’34’, into the variable.

We can take it a step further and have multiple variables as well.


Example 3:

RedirectMatch 301 /(.*)-widget-(.*).html$ http://www.newdomain.com/$1widget-$2/

If our original page is /blue-widget-34.html the new URL will be:

If our original page is /red-widget-89.html the new URL will be:


Free .htaccess generator

There is a free .htaccess generator here that you can use that will assist you in creating or editing your .htaccess file.


Ask a SEO Expert

Do you have a SEO or Internet Marketing question that you would like answered by a SEO professional?

If so please go to our SEO Roadmap Facebook page and submit it.

Steven Ferrino
Steven Ferrino
View all posts by Steven Ferrino
Steven's website
VN:F [1.9.22_1171]
Rating: 10.0/10 (1 vote cast)
VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)
301 Redirects Explained, 10.0 out of 10 based on 1 rating

9th October 2012 No Comments

Leave a Reply

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






Webinar Replay How to Increase Conversions and Traffic to Your Website

October 16th, 2014


Warning: Use of undefined constant php - assumed 'php' (this will throw an Error in a future version of PHP) in /home/customer/www/seotrainingsw.com/public_html/wp-content/themes/seoroadmap/sidebar.php on line 55