Redirect all of your non-www url to www (http and https)

You know There are lots of Resource to solve this problem. But I Have taken too Much Time to solve It. I easily redireted non-WWW to WWW When my url is http. But It's too difficult to solve It When I am in https. Here is important tips, u Your .htaccess Code Will Not Have It no https ssl Certificate for work. I do Not know about this.

Was I trying and trying on my server where TEST There is no ssl Certificate. For this my REASON Code Was Not working. After I implement Then on a Website Which Has It ssl Certificate. After Then Code Works.
Here is the code of htaccess -
RewriteEngine On RewriteCond% {HTTPS} ^ on $ RewriteRule (.*) https://%{HTTP_HOST}/$1 [R, L] RewriteCond% {HTTPS} on RewriteCond% {HTTP_HOST}! ^www\. RewriteRule ^ (.*)$ https://www.%{HTTP_HOST}/$1 [R = 301, L] RewriteCond% {HTTP_HOST}! ^www \. RewriteRule ^ (. *)$ https://www.%{HTTP_HOST}/$1 [R = 301, L]
.htaccess File you can put on you this Code. Then all WWW url to REDIRECTED. If you ask to Forget Me Not Face Any problem do on The comment section.


Popular Posts

Install and configure Network simulator (ns3) on Ubuntu 14.04