using RedirectMatch to make Apache2 listen to several dns names and still not get content duplication

The trick we do here is to make one virtualhost for the “main” domain you wish indexed (and shown in browsers etc) and another one for all the other domains that will simply redirect to the main domain.

<VirtualHost *:80>
    ServerName example.com
    ServerAlias example.net
    ServerAlias example.biz
    RedirectMatch permanent /(.*) http://www.example.com/$1
</VirtualHost>
 
<VirtualHost *:80>
    ServerName www.example.com
    ... other stuffs ...
</VirtualHost>