Sometimes to protect your brand you will have several domains relating to one site however you may only want your visitors see the main domain in the web browser.
As an example we have ukwebsolutionsdirect.com and ukwebsolutionsdirect.co.uk, our main domain name for our site is ukwebsolutionsdirect.co.uk so anyone visiting ukwebsolutionsdirect.com is redirected to the .co.uk domain.
All you need to do is add a little mod_rewrite code as shown below to your .htaccess file, you will find the .htaccess file in your public_html folder.
There are two examples below, the first being for a .co.uk domain and the second for .com domain name.
###### .CO.UK DOMAIN EXAMPLE ###########
Options +FollowSymlinks RewriteEngine on RewriteBase / RewriteCond %{HTTP_HOST} !^exampledomain\.co\.uk$ RewriteRule ^(.*)$ http://exampledomain.co.uk/$1 [R=permanent,L]
###### .COM DOMAIN EXAMPLE ############
Options +FollowSymlinks RewriteEngine on RewriteBase / RewriteCond %{HTTP_HOST} !^exampledomain\.com$ RewriteRule ^(.*)$ http://exampledomain.com/$1 [R=permanent,L]
NOTE: Don't forget to replace "exampledomain.com" with your actual domain name.