Hi johnifav,
Here is what I am using; part is collected from posts on
http://www.webmasterworld.com (quite useful site), part I came up with.
# Rule for duplicate content removal :
http://www.mysite.com vs mysite.com
RewriteCond %{HTTP_HOST} ^mysite\.com [NC]
RewriteRule (.*)
http://www.mysite.com/$1 [R=301,L,NC]
# Rule for duplicate content removal :
http://www.mysite.com/home/ link to
http://www.mysite.comRewriteRule ^home/$
http://www.mysite.com/ [R=301,L,NC]
[NC] is there to make it case insensitive
[R=301] makes it a permanent redirection
[L] makes a rule the last one to be used
^ marks the beginning of a string
$ marks the end of a string
as . is special character, you must escape it using \ when you have to use it in a string : mysite\.com
In the first Rewriterule, . means any character, * means any number of said character, so .* means any string
Putting it in between parenthesis (.*) makes that string a variable, re-used later in the rule as $1 (there could be more variables, named $2, $3,... in sequence)
I have seen also a variation of the first part similar to :
# Rule for duplicate content removal :
http://www.mysite.com vs mysite.com
RewriteCond %{HTTP_HOST} !^www\.mysite\.com [NC]
RewriteRule (.*)
http://www.mysite.com/$1 [R=301,L,NC]
The difference is : in the first version, only mysite.com is 301-redirected to
http://www.mysite.com; In the second version, any subdomain is 301-redirected to
http://www.mysite.com (like : whatever.mysite.com or thisIsATyyypo.mysite.com), except if the subdomain actually exists. However, I have not tested this version at all.
As in other programming language, the ! looks negates the value of the subsequent statement.
Hope it will also work for you,
Regards