PCI Compliant Web Hosting and Managed Service Provider
Hosting Solutions since 1995

Redirection 101 – Learning how to use redirects for SEO and site changes

Author: ; Published: Jun 4, 2011; Category: Managed Hosting, WordPress; Tags: ; No Comments

If you are like me, you will be tweaking your Web site over time.  Sometimes those tweaks will involving a site redesign, and sometimes it is just a matter of organizing your site better for search engine optimization — SEO — or making it easier for visitors to find a given page (the first choice of page name made sense at the time, but not now).

These changes sometimes means the web page address changes; and, now you have a problem with search engines leading people to the old web page address (that no longer exists, and results in a 404 page not found error), or a long time customer / friend / visitor has the old web page bookmarked.

How can you help those who bookmarked areas of your site as well as the search engines find the new pages?

On our managed Linux hosting, which supports the Apache rewrite engine, you can make easy modifications to your .htaccess file to redirect visitors from old pages and even old folders (directories & sub directories) to the new pages and new areas of your site. You can download the existing .htaccess file — if you are using WordPress, see our starter .htaccess file — or create one in notepad or your favorite text editor (just remember to save the file as “.htaccess” — no extension — as plain text with no formatting).  Typically you will have this file in the root of your document directory (on our Linux servers, this is in your domain name folder).

Somewhere before you start the statements to redirect visitors from old areas and pages to new areas and pages, within your .htaccess file you will have two lines to turn on the Apache rewrite engine, and to let the rewrite engine know the starting point (typically this is the root of the document directory which is referenced by “/”).

RewriteEngine On
RewriteBase /

If you are using our starter .htaccess file, or one based on it, the above statements will already be present in the file; do not create duplicates of those statements, you only need them once.

Now you are ready to enter the statements which will help your visitors and search engines find the new pages and new areas of your site.  You have several choices, and I will deal with three of them in this article:

  1. Redirecting from an old machine name (subdomain name) such as wp.dynamicnet.net to www.dynamicnet.net
  2. Redirecting individual pages to new pages.
  3. Redirecting folders to a new page or new folder structure.

The first type is handled by using the RewriteCond and RewriteRule statements which look like the following:

# machine name redirects
RewriteCond %{HTTP_HOST} ^wp.dynamicnet.net$ [OR]
RewriteCond %{HTTP_HOST} ^www.wp.dynamicnet.net$
RewriteRule (.*)$ http://www.dynamicnet.net/ [R=301,L]

The above tells the web server that if a visitor or search engine is trying to visit or send the visitor to http://www.dynamicnet.net/ (home page) instead.

The second type of redirect, from page to page, is very straight forward taking only one statement per page you want to redirect (please note the below may word wrap in your browser, but each redirect should be one line with no line breaks).

# page redirects
redirect 301 /services/domain_name_registration_prices.htm      http://www.dynamicnet.net/managed-hosting/shared-web-hosting/domain-name-registration/
redirect 301 /services/webrates.htm                                              http://www.dynamicnet.net/managed-hosting/shared-web-hosting/shared-hosting-addons-optional-features/
redirect 301 /services/hsphere_server_hardening.htm                  http://www.dynamicnet.net/managed-services/managed-server-security/server-hardening/

The third type of redirect, from a folder to a folder or page is also done one statement as a time using the redirectmatch command (please note the below may word wrap in your browser, but each redirect should be one line with no line breaks).

# folder redirects
RedirectMatch 301 /customer/help/(.*)$                                  http://www.dynamicnet.net/customer-support/
RedirectMatch 301 /customer/h-sphere/security/(.*)$             http://oldsite.dynamicnet.net/customer/h-sphere/security/$1
RedirectMatch 301 /customer/h-sphere/reseller/(.*)$              http://www.dynamicnet.net/customer-support/reseller-control-panel-documentation/

The first and last of the RedirectMatch statements above redirect  the request from any page within an older folder structure to a specific page on the new site.  The middle statement will redirect visitors from a specific folder / page of their choice to a the same page on a different address (the $1 at the end keeps the page name the visitor or search engine was using).

One of the questions our customer support team is asked from time to time what are the ways to find out which pages and folders you should redirect.  You have a number of options to chose from to find out what pages are no longer found on your site that are generating 404 errors:

  • You can use Google webmaster tools
  • If you use WordPress, the SEO Ultimate plugin has a 404 monitor
  • If you use WordPress, another good plugin to check for broken links (which lead to 404 page not found errors) is using the Broken Link Checker plugin.
  • You can review your site’s error log for 404 page not found errors.

Since we take our managed hosting seriously, if you don’t have time for the above steps or you find the above steps a little daunting, contact our customer support department letting us know you need help.

Peter Abraham
Former CEO of Dynamic Net, Inc. Will be transitioning to a new career in the near future.
Peter Abraham

@

Peter Abraham

Leave a Comment