The solution is very simple - use the Redirect
directive.
Example:
Redirect permanent / http://mydomain.ca
This code should go in your .htaccess file and be uploaded to the root of mydomain.com.
Alternatively, if they're on the same virtual host, you can usemod_rewrite
:
RewriteEngine on
RewriteCond %{HTTP_HOST} !^mydomain\.com$
RewriteRule ^ http://mydomain.ca%{REQUEST_URI} [L,R=301]
The R
flag also indicates the HTTP status code (301 - Moved Permanently).