You can check the status of HTTPS by using RewriteCond {%HTTPS} on (or !on)
You can check for www. on the host using RewriteCond {%HTTP_HOST} ^www\.(.*)$ (or !^www\.(.*)$). The pattern matched is in %n, and RewriteRule backreferences are $n.
You can rewrite URLs using RewriteRule ^(.*)$ http://www.%1/$1 [R=301,L]. By switching http for https and removing the www., you can change this to fit the HTTPS rule.
Grab the Apache Mod_Rewrite Documentation. Also http://whathaveyoutried.com.
You can check the status of
HTTPSby usingRewriteCond {%HTTPS} on(or!on)You can check for
www.on the host usingRewriteCond {%HTTP_HOST} ^www\.(.*)$(or!^www\.(.*)$). The pattern matched is in%n, andRewriteRulebackreferences are$n.You can rewrite URLs using
RewriteRule ^(.*)$ http://www.%1/$1 [R=301,L]. By switchinghttpforhttpsand removing thewww., you can change this to fit theHTTPSrule.The final code:
And I'll say it again, http://whathaveyoutried.com