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>

Apache2 unseting AddDefaultCharset (via .htaccess)

Setting a default charset using .htaccess is a simple thing to do

However sometimes there is a need to unset default charset as well (for instance if the AddDefaultCharset is set in the apache config and this is causing problems).

This is very easy to do just edit the .htaccess file and add a line that says

AddDefaultCharset OFF

Apache2 changing charset using .htaccess

If you do not wish to change character encoding for the entire server, but only one site (or only one directory) then this is possible to do using .htaccess.

AddDefaultCharset UTF-8

If you only wish to do this to php or htm files (and not all files)

<FilesMatch "\.(htm|php)$">
AddDefaultCharset UTF-8
</FilesMatch>

If you wish to modify the mime-type as well as the encoding (on html files in this example)

AddType 'text/html; charset=UTF-8' html