Redirect to www using htaccess redirect

This tutorial will show you how to redirect to www using htaccess redirect

Understaning the usage of .htaccess.

1.Create a .htaccess file with the below code, (With Notepad)

2.Please ensure that all requests coming in to will get redirected to
3.The .htaccess file needs to be placed in the root directory of your old website (i.e the same directory where your index file is placed)


.htaccess code:

RewriteEngine on
rewritecond %{http_host} ^ [nc]
rewriterule ^(.*)$$1 [r=301,nc]

4.Please REPLACE and with your actual domain name.

5.Save the notepad and upload the .htaccess file to the FTP through FIlemanagner or Filezilla.
Note* This .htaccess method of redirection works ONLY on Linux servers having the Apache Mod-Rewrite moduled enabled.