How to redirect non-www URLs to www?
Author: admin admin Reference Number: AA-00423 Views: 3894 Created: 2016-02-09 07:33 Last Updated: 2016-02-09 07:33 0 Rating/ Voters

In order to redirect all of the requests for to, you should set the appropriate rewrite rule. This can be done by adding the following lines at the beginning of the .htaccess file in your public_html folder:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^ [NC]
RewriteRule ^(.*)$$1 [L,R=301]

From now on, when someone accesses s/he will be redirected to

Using this method is safe because it should not create any redirection loops or interfere with other rewrite rules.

Quick Jump Menu