How to setup a redirect from non-www pages to www

To redirect your site from non-www variant to the variant with www you should add the following lines to your .htaccess file:

RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]

Should you have any questions on this article or would like to learn more about our Magento plugins, Magento 2 extensions or services, we will be more than happy to help. To submit your request, please follow this link.