From 33b5010fd03e27f02e97efdf9ddcb7c48ac3281c Mon Sep 17 00:00:00 2001 From: =?utf8?q?Isma=C3=ABl=20Bouya?= Date: Tue, 24 Dec 2019 14:00:21 +0100 Subject: [PATCH] Redirect websites landing pages --- modules/private/websites/chloe/production.nix | 9 ++++++++- modules/private/websites/ludivinecassal/production.nix | 4 ++++ modules/private/websites/piedsjaloux/production.nix | 4 ++++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/modules/private/websites/chloe/production.nix b/modules/private/websites/chloe/production.nix index 3d267f2..578bf91 100644 --- a/modules/private/websites/chloe/production.nix +++ b/modules/private/websites/chloe/production.nix @@ -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" diff --git a/modules/private/websites/ludivinecassal/production.nix b/modules/private/websites/ludivinecassal/production.nix index c6f0cf3..7cf00f0 100644 --- a/modules/private/websites/ludivinecassal/production.nix +++ b/modules/private/websites/ludivinecassal/production.nix @@ -85,6 +85,10 @@ in { root = pcfg.webappDirs.ludivinecassal_prod; extraConfig = [ '' + RewriteEngine on + RewriteCond "%{HTTP_HOST}" "!^ludivinecassal\.com$" [NC] + RewriteRule ^(.+)$ https://ludivinecassal.com$1 [R=302,L] + SetHandler "proxy:unix:${pcfg.phpListenPaths.ludivinecassal_prod}|fcgi://localhost" diff --git a/modules/private/websites/piedsjaloux/production.nix b/modules/private/websites/piedsjaloux/production.nix index 28f85eb..e4e29c7 100644 --- a/modules/private/websites/piedsjaloux/production.nix +++ b/modules/private/websites/piedsjaloux/production.nix @@ -74,6 +74,10 @@ in { root = pcfg.webappDirs.piedsjaloux_prod; extraConfig = [ '' + RewriteEngine on + RewriteCond "%{HTTP_HOST}" "!^www.piedsjaloux\.fr$" [NC] + RewriteRule ^(.+)$ https://www.piedsjaloux.fr$1 [R=302,L] + SetHandler "proxy:unix:${pcfg.phpListenPaths.piedsjaloux_prod}|fcgi://localhost" -- 2.41.0