If you want to redirect from URL without www (example.com) to URL with www (www.example.com) then this can be done easy be adding following rules to .htaccess:

RewriteCond %{HTTP_HOST} ^[^.]+\.[^.]+$
RewriteCond %{HTTPS}s ^on(s)|
RewriteRule ^ http%1://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]


  • Include HTTP and HTTPS protocol.
  • Makes all URL-s consistent.
  • Prevent from duplicate content that search engines will not collect same data more that once.


You can leave a response, or trackback from your own site.

Before you add comment see for rules.

Leave a Reply

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