Redirect example.com to www.example.com for all possible values of example.com

If you wanted to do this generically for all domain names - that is, if you want to redirect example.com to www.example.com for all possible values of example.com, you could use the following recipe:
RewriteCond "%{HTTP_HOST}" "!^www\." [NC]
RewriteCond "%{HTTP_HOST}" "!^$"
RewriteRule "^/?(.*)"      "http://www.%{HTTP_HOST}/$1" [L,R,NE]
These rulesets will work either in your main server configuration file, or in a .htaccess file placed in the DocumentRoot of the server.

This is the best solution when you are looking for redirect non www website to www. 
Dont hesitate about it work or not, but i am sure and well tested. Go for it and add above code on your website.

Comments

Popular posts from this blog

My Response is on my own Website : Best Quality Backlink Strategy

disk tv connection near agam singh nagar siliguri

Why is Digital Marketing Important? What are the Advantages of Digital Marketing?