A generic piece of code you can drop in all of your root .htaccess files to force www., or do the opposite and remove the www. in the URL no matter what the domain name is.
The method described here originates from the IDT blog and was written by Manuel in 2012.
To avoid SEO and cookie issues you can set up your website with or without "www." in the URL. The code below will work on any domain name so it's really easy to include it in your "default" root .htaccess file.
Check the following article for use with: HTTPS »