How to set up redirection to a domain WITH a ‘www’ prefix?

In the hosting control panel

How to open the hosting control panel

  1. in the Domains section, click on Redirects;
  2. select the necessary domain in the drop-down list. Tick the checkbox ‘Do not redirect www’. In the ‘redirects to’ field, specify your domain with an ‘http://www’ prefix.
  3. Click Add to add a redirect.

Using the file .htaccess

Proceed to your website root directory and add the following lines to the file ‘.htaccess’ (please mind the dot in the beginning of the file name):

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

where site.com is your domain name.

If .htaccess does not exist yet, just go ahead and create it.