Need to change your domain name? Create 301 Redirects

Need to change your domain name? Create 301 Redirects

0 3033
301 Redirects - Bossa Nova Interactive

301 Redirects - Bossa Nova InteractiveSome years back, we changed our domain name from bossanovadesign.com to bossanovaWEBdesign.com. This year, we’re changing the entire business name to Bossa Nova Interactive, and of course that means yet another domain name change. To make sure our pages don’t get lost to users or to search engines, we’ve incorporated 301 redirects yet again.

How to implement a 301 Redirect

Here are the steps that we took to redirect all of our pages, sub-folders, and paths within our old website at bossanovawebdesign.com to our new website bossanovainteractive.com. We chose this exact method for several reasons, chief among them that we wanted to let Google and other search engines know that the pages have been permanently moved. We also changed the folder and category structure of our site, so it was important to map each page’s path to the new page’s path. If we had simply redirected the entire top level domain, all users would be redirected to the home page of the new site (which is a bad user experience,) and we may have also lost ranking on certain articles.

About 301 Redirects

While there are many ways to redirect a page, the 301 method is the one we’re using because it is a message to search engines that the pages have permanently moved. And there are also many types of 301 redirects, but we’re going to be showing you how we used an .htaccess file for ours.

You will need:

    • An FTP Client (Transmit for Mac or Filezilla for PC)
    • A text editor (TextMate for Mac or Notepad ++ for PC)
    • A list of all of your pages, or a site map. Here are two ways to get it: *
      • If you’re on WordPress (self-hosted) install a plugin to help render a sitemap.xml for Google. You may already have this, so check your root folder for a file called sitemap.xml. If you have the plugin installed, regenerate the site map file before you start. Put it into a text editor, and remove everything except for the actual full URLs from your site.
      • Or you can manually map out the URLs from your website. Click on each page or post and copy the URL down into a blank text file. You can also perform a Google search using site: and your exact domain name (ex: site:bossanovawebdesign.com)

*if anyone knows a better way to get a plain text list of a site’s URLs, please leave a comment below or contact us.

Plain text file with URLs listed

Once you have your URL list, go ahead and save the file as url-list.txt

Got that saved? Ok, good. Now save it again as url-path-list.txt This will be a list of your subfolders, pages and paths underneath of your domain name. It’s okay if you don’t quite follow this step yet, but trust us when we say you will want to keep two copies of the URL list, one unedited for later use, and one that we’re about to use now.

Editing url-path-list.txt

Remove the domain name from each URL, from the http:// to the .com(or whatever extension you’re using. Leave the trailing slash ? / ? and anything after it. See below example:

Before

http://bossanovawebdesign.com/
http://bossanovawebdesign.com/work/
http://bossanovawebdesign.com/about/

After
/
/work/
/about/

For the home page, we’ll add index.php (or .html, or whatever your website setup is using. For WordPress, it’s most likely index.php) to the trailing slash so our list looks like this:

After (edited)
/index.php
/work/
/about/

Remove the domain from each URL in your list as the above example states, plus add index.php to the home page after the trailing slash. Save the file and move on to the next step.

Htaccess File

  1. Start by creating a blank text file called htaccess.txt
  2. Next, copy the list of paths from url-path-list.txt and paste them into htaccess.txt
  3. At the beginning of each line, type redirect 301
  4. After the path on each line, type the full URL of the page where you want the site to redirect. Our paths were a little different due to some changes in naming convention on the new site, as shown below.
    redirect 301 /index.php http://bossanovainteractive.com/
    redirect 301 /work/ http://bossanovainteractive.com/category/portfolio/
    redirect 301 /about/ http://bossanovainteractive.com/about/
  5. Complete that process for all of your URLs and save htaccess.txt
  6. Upload htaccess.txt to the root of your webserver (typically public_html or similar.)
    Note: You need to upload this to your OLD server, not your new server.

But wait, there’s more!

Don’t stop now, because there’s still the matter of moving that period in the file name. An .htaccess file is usually a hidden file located in your public_html folder. You can usually see it with an FTP client, but if you downloaded an .htaccess file to your computer, you may not be able to see it. That’s why we saved it as a .txt file first, then uploaded to the server. But wait, there’s even more!

<caps>
PRO-TIP: CHECK TO SEE IF YOU ALREADY HAVE AN .htaccess FILE ON YOUR WEB SITE HOSTING SERVER!
</caps>

If you do, then try to open the copy that is on the server from inside your FTP client. In most cases, you can right click on the file on the right side window of the FTP program, then select “Open With” and choose your plain-text editor. Copy the contents of that file and save them to your htaccess.txt file on your computer.

Often the mod-rewrite code that WordPress needs for permalinks and other functions are in this file. You can place their code at the bottom of your list. Note our example at the end. Obviously if you are redirecting every page from your old site, then you don’t need to worry about the existing .htaccessfile. However, you can use this method to only redirect one or two pages to anywhere you’d like.

  • Again, upload your htaccess.txt file to your server.
  • From the file list on the server, rename htaccess.txt to .htaccess which can be typically done by right clicking on the file name on the right side window of the FTP client and renaming the entire file name. Don’t forget to remove the .txt
  • Your redirects should now be live. Test them with the Redirect Checking Tool from Ragepank. If you’re interested, here’s what our final .htaccess file looked like.
    redirect 301 /index.php http://bossanovainteractive.com/
    redirect 301 /work/ http://bossanovainteractive.com/category/portfolio/
    redirect 301 /about/ http://bossanovainteractive.com/about/
    redirect 301 /contact/ http://bossanovainteractive.com/contact/
    redirect 301 /archives/ http://bossanovainteractive.com/archives/
    redirect 301 /links/ http://bossanovainteractive.com/links/
    redirect 301 /blog/ http://bossanovainteractive.com/blog/
    redirect 301 /virginia-beach-rock-gym-website-redesign/ http://bossanovainteractive.com/localseo/virginia-beach-rock-gym-website-redesign-and-keyword-research/
    redirect 301 /the-heroes-art-ball-site-website-design/ http://bossanovainteractive.com/webdesign/the-heroes-art-ball-site-website-design/
    redirect 301 /standards-based-web-design/ http://bossanovainteractive.com/webdesign/standards-based-web-design/
    redirect 301 /301-redirects-and-the-googlebot/ http://bossanovainteractive.com/localseo/301-redirects-and-the-googlebot/
    redirect 301 /best-practices-for-wordpress-titles/ http://bossanovainteractive.com/webdesign/best-practices-for-wordpress-titles/
    redirect 301 /privacy-policy/ http://bossanovainteractive.com/privacy-policy/
    redirect 301 /hampton-roads/ http://bossanovainteractive.com/localseo/hampton-roads/
    redirect 301 /ziggity-zoom/ http://bossanovainteractive.com/portfolio/ziggity-zoom-site-analytics/
    redirect 301 /mommie-911/ http://bossanovainteractive.com/portfolio/mommie-911-ad-campaign-management/
    redirect 301 /friends-of-geraldine/ http://bossanovainteractive.com/webdesign/friendsofgeraldine-org-blog-customization/
    redirect 301 /kemper-consulting/ http://bossanovainteractive.com/webdesign/kemper-consulting-web-site-redesign/
    redirect 301 /casa-amarilla/ http://bossanovainteractive.com/webdesign/casa-amarilla-web-site-design/
    redirect 301 /wordpress-3-0-and-nextgen-plugin-upgrade-issues/ http://bossanovainteractive.com/webdesign/wordpress-3-0-and-nextgen-plugin-upgrade-issues/
    
    # BEGIN WordPress
    
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    
    # END WordPress

Got questions? Know a better way? Leave a comment below.

 Name: Email: We respect your email privacyPowered by AWeber Email Marketing Software 

NO COMMENTS

Leave a Reply

This blog is kept spam free by WP-SpamFree.