Know about .htaccess file
When a visitor/spider requests a web page, your web serverchecks for a .htaccess file. The .htaccess file containsspecific instructions for certain requests, includingsecurity, redirection issues and how to handle certainerrors.
Know about 301 redirect
301 redirect is the best method to preserve your currentsearch engine rankings when redirecting web pages or a website. The code "301" is interpreted as "moved permanently".After the code, the URL of the missing or renamed page isnoted, followed by a space, then followed by the newlocation or file name. You implement the 301 redirect bycreating a .htaccess file.
How to implement the 301 Redirect
1. To create a .htaccess file, open notepad, name and savethe file as .htaccess (there is no extension).
2. If you already have a .htaccess file on your server,download it to your desktop for editing.
3. Place this code in your .htaccess file:redirect 301 /old/old.htm http://www.you.com/new.htm
4. If the .htaccess file already has lines of code in it,skip a line, then add the above code.
5. Save the .htaccess file
6. Upload this file to the root folder of your server.
7. Test it by typing in the old address to the page you'vechanged. You should be immediately taken to the newlocation.
Notes: Don't add "http://www" to the first part of thestatement - place the path from the top level of your siteto the page. Also ensure that you leave a single spacebetween these elements:
redirect 301 (the instruction that the page has moved)
During the next update, the old file name and path will bedropped and replaced with the new one. Sometimes you maysee alternating old/new file names during the transitionperiod, plus some fluctuations in rankings. According toGoogle it will take 6-8 weeks to see the changes reflectedon your pages.
Other ways to implement the 301 redirect:
1. To redirect ALL files on your domain use this in your.htaccess file if you are on a unix web server:
redirectMatch 301 ^(.*)$ http://www.domain.com
redirect 301 /index.html http://www.domain.com/index.html
2. If you need to redirect http://mysite.com tohttp://www.mysite.com and you've got mod_rewrite enabled onyour server you can put this in your .htaccess file:
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^example\.com
RewriteRule ^(.*)$ http://www.example.com/$1 [R=permanent,L]
or this:
Options +FollowSymLinks
3. If you want to redirect your .htm pages to .php pagesandd you've got mod_rewrite enabled on your server you canput this in your .htaccess file:
RewriteEngine on
AddType text/html .shtml
DirectoryIndex index.shtml index.html