redirect without www to www

In order to redirect all of the requests for yourdomain.com to www.yourdomain.com, 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

# adapt and uncomment the following:

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

put above code in .htacess

Was this article helpful?