Posts Tagged ‘apache’
This is a pretty simple use of mod_rewrite to force the use www in your urls.
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.example\.com$ [NC]
RewriteRule .? http://www.example.com%{REQUEST_URI} [R=301,L]\
The first line is only needed if mod_rewrite isn’t enabled on your server (though the module does need to be enabled). Replace example.com with your actual domain name of course.
