Redirect non-www URLs to www

For create the redirect from non-www URLs to www you need add the bottom code to the file «.htaccess» (file is located in the site root).
This code will only work for HTTP. For secure HTTPS connections this doesn't work, need other records.

<IfModule mod_rewrite.c>
	Options +FollowSymLinks
	RewriteEngine On
	RewriteBase /

	# Redirect non-www to www (for HTTP)
	RewriteCond %{HTTP_HOST} !^$
	RewriteCond %{HTTP_HOST} !^www\. [NC]
	RewriteCond %{HTTP_HOST} (.+)$
	RewriteRule ^(.*)$ http://www.%1/$1 [R=permanent,L]