<VirtualHost 11.22.33.44>
    # Server name and a single alias without a subdomain prefix.
    ServerName www.example.com
    ServerAlias example.com

    # Redirect to 'www.' subdomain.
    RewriteEngine on
    RewriteCond %{HTTP_HOST}    !^www.example.com           [NC]
    RewriteCond %{HTTP_HOST}    !^$
    RewriteRule ^/(.*)          http://www.example.com/$1   [L,R]
</VirtualHost>
