My experience after few days rummaging SO and other hosts instructions was disappointing. However, I cherry-picked the best workful parts of all of them and yields the following:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.domain1\.com$ [OR]
RewriteCond %{HTTP_HOST} ^domain1\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.domain2\.com$ [OR]
RewriteCond %{HTTP_HOST} ^domain2\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.domain3\.com$ [OR]
RewriteCond %{HTTP_HOST} ^domain3\.com$
RewriteRule ^/?$ "http\:\/\/www\.domain\.com\/" [R=301,L]
- The above format is also according to cPanel style of redirection done in GUI.
- Redirection of www. version and non-www. version of domains is one of the issues which other solutions (at least I tried em!) couldn't solve it.
- Pay attention to
^/?$
in RewriteRule
If you want to redirect www version of the main domain to the non-www version of it, the last two lines should be like this:
RewriteCond %{HTTP_HOST} ^www\.domain\.com$
RewriteRule ^/?$ "http\:\/\/domain\.com\/" [R=301,L]
Good Redirection!
[OR]
at the end of each domain was not in your answer, and that solved my problem. – Vizza