add WWW's to no WWW's

Categories:

RewriteEngine on
 
# If your site can be accessed both with and without the 'www.' prefix, you
# can use one of the following settings to redirect users to your preferred
# URL, either WITH or WITHOUT the 'www.' prefix. Choose ONLY one option:
#
# To redirect all users to access the site WITH the 'www.' prefix,
# (<a href="http://example.com/" title="http://example.com/">http://example.com/</a>... will be redirected to <a href="http://www.example.com/" title="http://www.example.com/">http://www.example.com/</a>...)
# adapt and uncomment the following:
# RewriteCond %{HTTP_HOST} ^example\.com$ [NC]
# RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301]
#
# To redirect all users to access the site WITHOUT the 'www.' prefix,
# (<a href="http://www.example.com/" title="http://www.example.com/">http://www.example.com/</a>... will be redirected to <a href="http://example.com/" title="http://example.com/">http://example.com/</a>...)
# uncomment and adapt the following:
# RewriteCond %{HTTP_HOST} ^www\.example\.com$ [NC]
# RewriteRule ^(.*)$ http://example.com/$1 [L,R=301]