Well, I've found a workaround (I am not so familiar with .htaccess, after all ).
To put it another words: I have 4 different domains, say maindomain, domain2, domain3 and domain4 on a virtual server. Physically, I have a single site, except for some includes which makes the four "indexes" slightly different and give different values to the document's title and meta tags for keywords, according to each of those domains.
Now, my boss wanted 2 extra things: To insert some keywords inside the menu's links, each domains with his own keyword, but when click on those links, the user should be 301 redirect to the correspondent maindomain's (in other words, to redirect 301 to a link from which I should remove that keyword.
Everything works under php/MySQL on Apache.
To simplify, let's take the case of the contact.php link. On those 4 domains, in their indexes, the links towards that contact page should look like:
Now, from no matter the domain's indexes, those links should redirect, all of them, to the unique file:
My solution so far (it works) is:
RewriteRule ^(.*)_contact http://maindomain/contact.php [R=301,L]
[COLOR="Gray"]# and repeat the line for all the other menu's links (tariffs, skills...)[/COLOR]
RewriteRule ^(.*)_tariffs http://maindomain/tariffs.php [R=301,L]
RewriteRule ^(.*)_skills http://maindomain/skills.php [R=301,L]
Thankfully I have only 12 pages to be linked from the menu, thus I wrote 12 code lines.
I was only wondering if I could have refined the code in a more dynamical way