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]

Benefits

  • 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.
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...

Comments

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 *

0l8q7f