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.

No related posts.

Related posts brought to you by Yet Another Related Posts Plugin.

2 Responses to “Force the use of ‘www’ in your URL.”

Leave a Reply