301 Redirect in Apache
A common problem that site owners have is that occasionally they need to change things up. Maybe you upgrade your html site to Drupal or you need to reorganize your product categories. The concern is that you've done a lot of work to make those pages rank well and if you change their URL then they'll drop out of Google. If you are moving a bunch of your content around on your site but you don't want to lose your position in the search engines then it's a good idea to do a 301 Redirect. A 301 will tell the search engines that the file in question has permanently moved to a new location. (The numbers "301" is the error code that servers use to communicate to each other.)
Here's how to do a 301 Redirect on a Unix/Linux server running Apache:
1. There is a special file called ".htaccess" that is usually on the root level of your website. Yes, it really has a period in front of it and nothing before the period. Your .htaccess file tells search engine robots about redirects on your site and serves other purposes as well. NOTE: If you're browsing your server using an FTP client, it will often consider the .htaccess file as invisible. Look in your program's options/preferences and tell it to Show Invisible Files.
2. If you don't have an .htaccess file on your server, then you'll need to create one. It's easy! Using a plain text editor (like Notepad on the PC or TextEdit on the Mac) create an empty file. Save it with the filename .htaccess. If you are on a Unix based system (like Mac OS X) then you should probably name it my.htaccess so that it doesn't disappear. :-) Once the file is created, you're going to make your edits to it and then upload it to your server. Skip to step 4.
3. If there is already an .htaccess file be sure to go to the bottom of the file so that you don't overwrite any instructions that are already there. IMPORTANT NOTE: Make a backup of this file before you make any changes.
4. Add the following line to the bottom of your .htaccess file for each page that you need to redirect:
redirect 301 /directory/oldlocation.html http://www.mydomain.com/directory/newlocation.html
*Note: The first part "/directory/oldlocation.html" is the original location of the file being moved and the second part "http://www.mydomain.com/directory/newlocation.html" is the new, permanent location of the file.
5. Save and upload the .htaccess file to the root level of your website. (Root level means the topmost public area of your website.)