htaccess rule to redirect all links to www

You can redirect all the links in your domain to www by adding the below rule in the .htaccess file in your web root.

 

rewritecond %{http_host} ^yourdomain.com          [nc]
rewriterule ^(.*)$ http://www.yourdomain.com/$1   [r=301,nc]


Leave a Reply

Your email address will not be published. Required fields are marked *