Something like this should work:

 (* Serve the website over https *)
 vhostDefault where
   DocumentRoot = home "vhosts/smichel.me/htdocs";
   SSL = use_cert "/etc/apache2/ssl/user/smichel.me.pem";
 with end;

 (* Redirect http to https *)
 vhostDefault with
rewriteRule "^(.*)$" "http://smichel.me$1 <http://smichel.me$1/>" [redirectWith temp]
 end;

 (* Redirect www traffic to plain domain (http) *)
 web "www" with
rewriteRule "^(.*)$" "https://smichel.me$1 <https://smichel.me$1/>" [redirectWith temp]
 end;

 (* Redirect www traffic to plain domain (https) *)
 web "www" where
   SSL = use_cert "/etc/apache2/ssl/user/smichel.me.pem";
 with
rewriteRule "^(.*)$" "https://smichel.me$1 <https://smichel.me$1/>" [redirectWith temp]
 end;
--
I try to write short, functional emails.

On Sun, Mar 8, 2020 at 14:55, Kenneth Pronovici <[email protected]> wrote:
I'm working to enable HTTPS for all of my sites hosted at HCOOP. I started with brilliantwatersyoga.com <http://brilliantwatersyoga.com/>, because it's fairly simple.

Today, I have things configured so that <http://www.brilliantwatersyoga.com/><anything> redirects to <http://brilliantwatersyoga.com/><anything>, so my setup handles the www. but always just strips it.

When enabling SSL, I want to do something similar. I want all 3 of http://brilliantwatersyoga.com <http://brilliantwatersyoga.com/>, http://www.brilliantwatersyoga.com <http://www.brilliantwatersyoga.com/>, and https://www.brilliantwatersyoga.com <https://www.brilliantwatersyoga.com/> to redirect to https://brilliantwatersyoga.com <https://brilliantwatersyoga.com/> - so no matter where someone goes, they get redirected to the canonical https URL.

Can someone suggest the right way to do this? I know how to do this with raw Apache configuration, but I can't find the right way to do it in domtool. I've worked through all of the various examples in the wiki, but I can't find a combination such that all of the http and https URLs work as expected. A lot of the time, I end up with working https URLs but "Unconfigured Member Virtual Host" for the http URLs. My existing non-HTTPS domtool configuration is below.

Thanks,

KEN

----

dom "brilliantwatersyoga.com <http://brilliantwatersyoga.com/>" where
   DefaultAlias = false;
   CreateWWW = false;
   DefaultWebNode = "shelob";
with
dnsDefaultText "v=spf1 mx a:muffat.debian.org <http://muffat.debian.org/> a:mailly.debian.org <http://mailly.debian.org/> -all";

   vhostDefault where
      WebPlaces = [web_place_default "shelob"];
DocumentRoot = home "web/htdocs/brilliantwatersyoga.com <http://brilliantwatersyoga.com/>";
   with
alias "/.well-known" ( home "web/data/brilliantwatersyoga.com/.well-known <http://brilliantwatersyoga.com/.well-known>" );
   end;

   web "www" with
rewriteRule "^(.*)$" "http://brilliantwatersyoga.com <http://brilliantwatersyoga.com/>$1" [redirectWith permanent]
   end;

   dnsIP "mail" deleuze_ip;

   emailAlias "kenneth.pronovici" "pronovic";
   emailAlias "admin" "pronovic";
   emailAlias "webmaster" "pronovic";
   emailAlias "contact" "pronovic";
   emailAlias "support" "pronovic";
end;

_______________________________________________
HCoop-Help mailing list
[email protected]
https://lists.hcoop.net/listinfo/hcoop-help

Reply via email to