]> git.immae.eu Git - perso/Immae/Config/Nix.git/blobdiff - modules/private/websites/chloe/production.nix
Redirect websites landing pages
[perso/Immae/Config/Nix.git] / modules / private / websites / chloe / production.nix
index 3d267f2494595774004608769ddd7f60d028c926..578bf918cab22fecc52798a546560d1d731a3965 100644 (file)
@@ -33,7 +33,14 @@ in {
       certMainHost = "osteopathe-cc.fr";
       hosts        = ["osteopathe-cc.fr" "www.osteopathe-cc.fr" ];
       root         = chloe.apache.root;
-      extraConfig  = [ chloe.apache.vhostConf ];
+      extraConfig  = [
+        ''
+          RewriteEngine On
+          RewriteCond "%{HTTP_HOST}" "!^www\.osteopathe-cc\.fr$" [NC]
+          RewriteRule ^(.+)$ https://www.osteopathe-cc.fr$1 [R=302,L]
+          ''
+        chloe.apache.vhostConf
+      ];
     };
     services.websites.env.production.watchPaths = [
       "/var/secrets/webapps/${chloe.app.environment}-chloe"