From 80cdb0193d620a479c780febbea95aff9ca5e975 Mon Sep 17 00:00:00 2001
From: Daniel Berteaud <daniel@firewall-services.com>
Date: Mon, 18 Nov 2013 20:52:24 +0100
Subject: [PATCH] Redirect to SSL

---
 .../templates/etc/httpd/conf/httpd.conf/VirtualHosts/61RedirDl | 10 ++++++++++
 1 file changed, 10 insertions(+)
 create mode 100644 root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/VirtualHosts/61RedirDl

diff --git a/root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/VirtualHosts/61RedirDl b/root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/VirtualHosts/61RedirDl
new file mode 100644
index 0000000..9b1caa2
--- /dev/null
+++ b/root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/VirtualHosts/61RedirDl
@@ -0,0 +1,10 @@
+{
+my $sslport = $modSSL{'TCPPort'} || '443';
+my $status = $dl{'status'} || 'enabled';
+my $alias = $dl{'AliasOnPrimary'} || 'enabled';
+
+if (($port ne $sslport) && ($status eq 'enabled') && ($alias eq 'enabled')){
+    $OUT .= "    RewriteEngine on\n";
+    $OUT .= "    RewriteRule ^/dl(/.*|\$) https://%{HTTP_HOST}/dl\$1 \[L,R\]\n";
+}
+}