I've this:

I have to understand how to do in apache the redirect in one domain towards the other one, taking into accounts that whenever the .com the page would be the same on sites Example User request: www.mydomain.com/product1 Should redirect www.mydomain2.com/product1 It ought to be a 301 redirect

Used to do the next:

Options +FollowSymLinks -MultiViews
RewriteEngine On
RewriteBase /

# redirect all requests to www.domain2.com domain
RewriteCond %{HTTP_HOST} =www.domain.com
RewriteRule .* http://www.domain2.com%{REQUEST_URI} [R=301,L]

nevertheless its no longer working, basically visit www.domain.com/product1 it redirects to www.domain2.com, Always towards the home page.

My prediction is the fact that because its a magento multistore installation and both domain names are saved on a single magento installation.

This will work:

Options +FollowSymLinks 
RewriteEngine on

RewriteCond %{HTTP_HOST} ^www.old-domain.com$ [NC]
RewriteRule ^(.*)$ http://www.new-domain.com/$1 [R=301,L]