Advanced Online Marketing Services Firm / E-marketing Specialists
Vancouver  |  Toronto  |  Halifax

Featured Clients


 

Increase Your Sales With HACKER SAFE Certification

 


HACKER SAFE certified sites prevent over 99.9% of hacker crime.

 

301 Redirects: Redirecting your site, folders and pages

Submitted by paul on Tue, 2006-09-26 13:48.

This is just the beginning of this post. I will add much more later.

__________________________________________

How To Install a 301 Redirect

(This is for Apache servers ONLY - so check with your host if you’re not sure what you have. [ view hosts using apache servers ] If you have a MicroSoft server, I can’t help you… use our Google search box above to search for “301 Redirect using IIS”.)

The 301 Redirect : Class 101
A 301 redirect is typically the most spider and visitor friendly means for implementing a strategy to preserve your search engine rankings as well as pages that visitors have previously bookmarked - for pages that are no-longer there due to being moved, removed, or renamed.

For Apache based servers, a 301 redirect is coded into your .htaccess file.

What is a .htaccess file?
A .htaccess file is: a file typically located in your root directory that your web server checks for when a visitor or search engine spider requests a web page on your website. The .htaccess file contains specific instructions for certain types of requests, including security, redirection issues, missing pages and how to handle certain types of errors.

What is a 301 redirect?

The code “301″ is interpreted by the server and notifies the browser or search engine spider that the page(s) has “moved permanently”. Included in the code is the URL of the missing or renamed page(s), followed by the new location or file name.

How do I install a 301 redirect?
First, download the .htaccess file from the root directory of your website. If there is no .htaccess file there, you can simply create one with Notepad or a similar ASCII text editor. Be sure when you name the file that you put the “.” at the beginning of the file name. This file has no suffix for file type - just call it: .htaccess

If there is a .htaccess file already in your root directory, and it already contains lines of code, be sure NOT to change any existing code unless you are VERY familiar with the functions of the code.

Leave a line space after any existing code, then create a new line of code like this (using your domain and file names where applicable):

redirect 301 /oldFolder/oldPage.htm http://www.yoursite.com/newPage.htm

It’s that easy. Save the file, and upload it back into your server to test it out. You can do so by typing in the old address of the page you’ve changed/moved/removed. You should immediately be brought to the new page.

NOTE: Make sure NOT to add “http://www” to the FIRST part of the code (after ‘301′) - just input the path from the root level of your site to the page name.

Also, be sure that you leave a single space between these elements:

redirect 301 (the instruction that the page has moved)

/oldFolder/oldPage.htm (the original folder path and file name)

http://www.yoursite.com/newPage.htm (new path and file name)

Redirecting entire folders and sites with 301 redirect.
The 301 command is very powerful. You can redirect not just single files but entire folders, or even entire web sites - for example when changing domain names.

Redirecting Entire Folders:

Redirecting / redirect an entire whole folder detailed description

 
redirect 301 /folder/ http://www.example.com/newfolder/
redirectMatch 301 ^/folder/ http://www.example.com/newfolder/
redirectMatch 301 ^/folder/$ http://www.example.com/newfolder/
redirectMatch 301 ^/folder/(.+)$ http://www.example.com/newfolder/xyz/$1

Given the client-requested URL, "http://www.example.com/folder/foo.html", these different directives would redirect to the following URLs, respectively:

# http://www.example.com/newfolder/foo.html (foo.html --anything after the prefix-match-- is "copied" into the destination URL).
# http://www.example.com/newfolder/ (foo.html is "dropped" from destination URL).
# No redirect, requested URL must end in "/folder/" exactly.
# http://www.example.com/newfolder/xyz/foo.html ("newfolder" is substituted, "/xyz" is inserted, and "foo.html" is copied into the destination URL).

This example only illustrates some of the possibilites, since all of the redirectMatch patterns are start-anchored, but it should be enough to get you going.

Redirecting Entire Websites:

How to redirect your entire website detailed description

 redirect 301 / http://www.yoursite.com/

In the above example(s), the first “/” indicates that everything from the root level of the site down (to the folder name if specified) should be redirected. This is an excellent remedy for ensuring that no traffic or rankings are lost if you have to change your domain name.

Search engine spiders & 301 redirects
The 301 redirect is the safest way to preserve your search engine rankings. On it’s next visit, the search engine spider (a.k.a.: robot) will obey the new rule in your .htaccess file. The spider doesn’t actually read the .htaccess file, but recognizes and follows the instructions from the server.

Usually, in the next search engine update the old file name and path should replaced with the new one. Sometimes you may see alternating old/new file names during an update transition period, along with possible fluctuations in rankings as things settle. This is typical of search engine updates and may take a few weeks for things to settle. You should be aware that any change you make has risks - whether it’s altering page text, moving or renaming pages, or simply changing domain names. Search engine rules change as often as the weather, so stay updated in case the 301 redirect becomes a liability! (Join our feed, hint, hint!)

Changing old domain names - be patient.
When changing domain names and using a 301 redirect, it’s advisable to leave the old domain name and files in place for a few weeks to give the search engines time to index your changes.

Also, don’t forget to notify any website(s) linking to you of the domain name change as soon as possible. Once you remove the old domain name, any links pointing to your old site will have no effect on the ranking of your new site - so get ‘em changed over!!

—————————————————-

We learned everything we know and taught you about 301 redirects, and you’ll find a lot more resources, here: TamingTheBeast.net (thanks guys!)

 


Categories:


Join Our Free Newsletter