# 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]