summaryrefslogtreecommitdiff
path: root/templates
diff options
context:
space:
mode:
authormh <mh@immerda.ch>2010-10-25 22:58:24 +0200
committermh <mh@immerda.ch>2010-10-25 22:58:24 +0200
commita4358a825de159a145b877c7b7d7c795c72cb3b4 (patch)
tree3f9f0638c5834a3883c0b264995fb4bb8cba47e8 /templates
parent8d9291378001e8b0471895b084387261b730cdac (diff)
improve redirect, so we don't stick on the servername
Diffstat (limited to 'templates')
-rw-r--r--templates/vhosts/gitweb/gitweb.erb5
-rw-r--r--templates/vhosts/passenger/passenger.erb5
-rw-r--r--templates/vhosts/perl/perl.erb8
-rw-r--r--templates/vhosts/php/php.erb8
-rw-r--r--templates/vhosts/php_drupal/php_drupal.erb9
-rw-r--r--templates/vhosts/php_gallery2/php_gallery.erb8
-rw-r--r--templates/vhosts/php_joomla/php_joomla.erb8
-rw-r--r--templates/vhosts/php_mediawiki/php_mediawiki.erb8
-rw-r--r--templates/vhosts/php_silverstripe/php_silverstripe.erb8
-rw-r--r--templates/vhosts/php_simplemachine/php_simplemachine.erb8
-rw-r--r--templates/vhosts/php_spip/php_spip.erb8
-rw-r--r--templates/vhosts/php_typo3/php_typo3.erb8
-rw-r--r--templates/vhosts/php_wordpress/php_wordpress.erb8
-rw-r--r--templates/vhosts/redirect/redirect.erb4
-rw-r--r--templates/vhosts/static/static.erb5
-rw-r--r--templates/vhosts/webdav/webdav.erb8
16 files changed, 88 insertions, 28 deletions
diff --git a/templates/vhosts/gitweb/gitweb.erb b/templates/vhosts/gitweb/gitweb.erb
index 908177b..4beda07 100644
--- a/templates/vhosts/gitweb/gitweb.erb
+++ b/templates/vhosts/gitweb/gitweb.erb
@@ -29,7 +29,10 @@
AddDefaultCharset <%= default_charset %>
<%- end -%>
<%- if ssl_mode.to_s == 'force' then -%>
- Redirect permanent / https://<%= servername %>/
+ RewriteEngine On
+ RewriteCond %{HTTPS} !=on
+ RewriteRule (.*) https://%{SERVER_NAME}$1 [R=permanent,L]
+
<%- end -%>
SetEnv GITWEB_CONFIG <%= gitweb_config %>
diff --git a/templates/vhosts/passenger/passenger.erb b/templates/vhosts/passenger/passenger.erb
index c2198c3..fd9f555 100644
--- a/templates/vhosts/passenger/passenger.erb
+++ b/templates/vhosts/passenger/passenger.erb
@@ -27,7 +27,10 @@
CustomLog <%= logdir %>/access_log combined
<%- end -%>
<%- if ssl_mode.to_s == 'force' then -%>
- Redirect permanent / https://<%= servername %>/
+ RewriteEngine On
+ RewriteCond %{HTTPS} !=on
+ RewriteRule (.*) https://%{SERVER_NAME}$1 [R=permanent,L]
+
<%- end -%>
<%- if default_charset.to_s != 'absent' then -%>
AddDefaultCharset <%= default_charset %>
diff --git a/templates/vhosts/perl/perl.erb b/templates/vhosts/perl/perl.erb
index 056730a..b922637 100644
--- a/templates/vhosts/perl/perl.erb
+++ b/templates/vhosts/perl/perl.erb
@@ -31,7 +31,9 @@
<%- end -%>
<%- if ssl_mode.to_s == 'force' then -%>
- Redirect permanent / https://<%= servername %>/
+ RewriteEngine On
+ RewriteCond %{HTTPS} !=on
+ RewriteRule (.*) https://%{SERVER_NAME}$1 [R=permanent,L]
<%- end -%>
<%- if default_charset.to_s != 'absent' then -%>
@@ -229,7 +231,9 @@
ProxyPassReverse / http://127.0.0.1/
<%- if ssl_mode.to_s == 'force' then -%>
- Redirect permanent / https://<%= servername %>/
+ RewriteEngine On
+ RewriteCond %{HTTPS} !=on
+ RewriteRule (.*) https://%{SERVER_NAME}$1 [R=permanent,L]
<%- end -%>
<%- if default_charset.to_s != 'absent' then -%>
diff --git a/templates/vhosts/php/php.erb b/templates/vhosts/php/php.erb
index c19b174..97e9b10 100644
--- a/templates/vhosts/php/php.erb
+++ b/templates/vhosts/php/php.erb
@@ -31,7 +31,9 @@
<%- end -%>
<%- if ssl_mode.to_s == 'force' then -%>
- Redirect permanent / https://<%= servername %>/
+ RewriteEngine On
+ RewriteCond %{HTTPS} !=on
+ RewriteRule (.*) https://%{SERVER_NAME}$1 [R=permanent,L]
<%- end -%>
<%- if run_mode.to_s =~ /(proxy\-|static\-)?itk/ -%>
@@ -234,7 +236,9 @@
ProxyPassReverse / http://127.0.0.1/
<%- if ssl_mode.to_s == 'force' then -%>
- Redirect permanent / https://<%= servername %>/
+ RewriteEngine On
+ RewriteCond %{HTTPS} !=on
+ RewriteRule (.*) https://%{SERVER_NAME}$1 [R=permanent,L]
<%- end -%>
<%- if default_charset.to_s != 'absent' then -%>
diff --git a/templates/vhosts/php_drupal/php_drupal.erb b/templates/vhosts/php_drupal/php_drupal.erb
index 56e09ec..dc40e8a 100644
--- a/templates/vhosts/php_drupal/php_drupal.erb
+++ b/templates/vhosts/php_drupal/php_drupal.erb
@@ -30,7 +30,10 @@
CustomLog <%= logdir %>/access_log combined
<%- end -%>
<%- if ssl_mode.to_s == 'force' then -%>
- Redirect permanent / https://<%= servername %>/
+ RewriteEngine On
+ RewriteCond %{HTTPS} !=on
+ RewriteRule (.*) https://%{SERVER_NAME}$1 [R=permanent,L]
+
<%- end -%>
<%- if default_charset.to_s != 'absent' then -%>
AddDefaultCharset <%= default_charset %>
@@ -276,7 +279,9 @@
ProxyPassReverse / http://127.0.0.1/
<%- if ssl_mode.to_s == 'force' then -%>
- Redirect permanent / https://<%= servername %>/
+ RewriteEngine On
+ RewriteCond %{HTTPS} !=on
+ RewriteRule (.*) https://%{SERVER_NAME}$1 [R=permanent,L]
<%- end -%>
diff --git a/templates/vhosts/php_gallery2/php_gallery.erb b/templates/vhosts/php_gallery2/php_gallery.erb
index 2abe1b3..ee2275a 100644
--- a/templates/vhosts/php_gallery2/php_gallery.erb
+++ b/templates/vhosts/php_gallery2/php_gallery.erb
@@ -31,7 +31,9 @@
<%- end -%>
<%- if ssl_mode.to_s == 'force' then -%>
- Redirect permanent / https://<%= servername %>/
+ RewriteEngine On
+ RewriteCond %{HTTPS} !=on
+ RewriteRule (.*) https://%{SERVER_NAME}$1 [R=permanent,L]
<%- end -%>
<%- if default_charset.to_s != 'absent' then -%>
@@ -246,7 +248,9 @@
ProxyPassReverse / http://127.0.0.1/
<%- if ssl_mode.to_s == 'force' then -%>
- Redirect permanent / https://<%= servername %>/
+ RewriteEngine On
+ RewriteCond %{HTTPS} !=on
+ RewriteRule (.*) https://%{SERVER_NAME}$1 [R=permanent,L]
<%- end -%>
<%- if default_charset.to_s != 'absent' then -%>
diff --git a/templates/vhosts/php_joomla/php_joomla.erb b/templates/vhosts/php_joomla/php_joomla.erb
index 73029ad..47da796 100644
--- a/templates/vhosts/php_joomla/php_joomla.erb
+++ b/templates/vhosts/php_joomla/php_joomla.erb
@@ -31,7 +31,9 @@
<%- end -%>
<%- if ssl_mode.to_s == 'force' then -%>
- Redirect permanent / https://<%= servername %>/
+ RewriteEngine On
+ RewriteCond %{HTTPS} !=on
+ RewriteRule (.*) https://%{SERVER_NAME}$1 [R=permanent,L]
<%- end -%>
<%- if default_charset.to_s != 'absent' then -%>
@@ -270,7 +272,9 @@
ProxyPassReverse / http://127.0.0.1/
<%- if ssl_mode.to_s == 'force' then -%>
- Redirect permanent / https://<%= servername %>/
+ RewriteEngine On
+ RewriteCond %{HTTPS} !=on
+ RewriteRule (.*) https://%{SERVER_NAME}$1 [R=permanent,L]
<%- end -%>
<%- if default_charset.to_s != 'absent' then -%>
diff --git a/templates/vhosts/php_mediawiki/php_mediawiki.erb b/templates/vhosts/php_mediawiki/php_mediawiki.erb
index 447b34e..170623f 100644
--- a/templates/vhosts/php_mediawiki/php_mediawiki.erb
+++ b/templates/vhosts/php_mediawiki/php_mediawiki.erb
@@ -31,7 +31,9 @@
<%- end -%>
<%- if ssl_mode.to_s == 'force' then -%>
- Redirect permanent / https://<%= servername %>/
+ RewriteEngine On
+ RewriteCond %{HTTPS} !=on
+ RewriteRule (.*) https://%{SERVER_NAME}$1 [R=permanent,L]
<%- end -%>
<%- if default_charset.to_s != 'absent' then -%>
@@ -216,7 +218,9 @@
ProxyPassReverse / http://127.0.0.1/
<%- if ssl_mode.to_s == 'force' then -%>
- Redirect permanent / https://<%= servername %>/
+ RewriteEngine On
+ RewriteCond %{HTTPS} !=on
+ RewriteRule (.*) https://%{SERVER_NAME}$1 [R=permanent,L]
<%- end -%>
<%- if default_charset.to_s != 'absent' then -%>
diff --git a/templates/vhosts/php_silverstripe/php_silverstripe.erb b/templates/vhosts/php_silverstripe/php_silverstripe.erb
index 8f83c71..580af05 100644
--- a/templates/vhosts/php_silverstripe/php_silverstripe.erb
+++ b/templates/vhosts/php_silverstripe/php_silverstripe.erb
@@ -31,7 +31,9 @@
<%- end -%>
<%- if ssl_mode.to_s == 'force' then -%>
- Redirect permanent / https://<%= servername %>/
+ RewriteEngine On
+ RewriteCond %{HTTPS} !=on
+ RewriteRule (.*) https://%{SERVER_NAME}$1 [R=permanent,L]
<%- end -%>
# silverstripe
@@ -274,7 +276,9 @@
ProxyPassReverse / http://127.0.0.1/
<%- if ssl_mode.to_s == 'force' then -%>
- Redirect permanent / https://<%= servername %>/
+ RewriteEngine On
+ RewriteCond %{HTTPS} !=on
+ RewriteRule (.*) https://%{SERVER_NAME}$1 [R=permanent,L]
<%- end -%>
# silverstripe
diff --git a/templates/vhosts/php_simplemachine/php_simplemachine.erb b/templates/vhosts/php_simplemachine/php_simplemachine.erb
index d9d1f25..37ac794 100644
--- a/templates/vhosts/php_simplemachine/php_simplemachine.erb
+++ b/templates/vhosts/php_simplemachine/php_simplemachine.erb
@@ -31,7 +31,9 @@
<%- end -%>
<%- if ssl_mode.to_s == 'force' then -%>
- Redirect permanent / https://<%= servername %>/
+ RewriteEngine On
+ RewriteCond %{HTTPS} !=on
+ RewriteRule (.*) https://%{SERVER_NAME}$1 [R=permanent,L]
<%- end -%>
<%- if default_charset.to_s != 'absent' then -%>
@@ -222,7 +224,9 @@
ProxyPassReverse / http://127.0.0.1/
<%- if ssl_mode.to_s == 'force' then -%>
- Redirect permanent / https://<%= servername %>/
+ RewriteEngine On
+ RewriteCond %{HTTPS} !=on
+ RewriteRule (.*) https://%{SERVER_NAME}$1 [R=permanent,L]
<%- end -%>
<%- if default_charset.to_s != 'absent' then -%>
diff --git a/templates/vhosts/php_spip/php_spip.erb b/templates/vhosts/php_spip/php_spip.erb
index 6a26c4c..da42d40 100644
--- a/templates/vhosts/php_spip/php_spip.erb
+++ b/templates/vhosts/php_spip/php_spip.erb
@@ -31,7 +31,9 @@
<%- end -%>
<%- if ssl_mode.to_s == 'force' then -%>
- Redirect permanent / https://<%= servername %>/
+ RewriteEngine On
+ RewriteCond %{HTTPS} !=on
+ RewriteRule (.*) https://%{SERVER_NAME}$1 [R=permanent,L]
<%- end -%>
<%- if default_charset.to_s != 'absent' then -%>
@@ -234,7 +236,9 @@
ProxyPassReverse / http://127.0.0.1/
<%- if ssl_mode.to_s == 'force' then -%>
- Redirect permanent / https://<%= servername %>/
+ RewriteEngine On
+ RewriteCond %{HTTPS} !=on
+ RewriteRule (.*) https://%{SERVER_NAME}$1 [R=permanent,L]
<%- end -%>
<%- if default_charset.to_s != 'absent' then -%>
diff --git a/templates/vhosts/php_typo3/php_typo3.erb b/templates/vhosts/php_typo3/php_typo3.erb
index e80aede..8195e41 100644
--- a/templates/vhosts/php_typo3/php_typo3.erb
+++ b/templates/vhosts/php_typo3/php_typo3.erb
@@ -31,7 +31,9 @@
<%- end -%>
<%- if ssl_mode.to_s == 'force' then -%>
- Redirect permanent / https://<%= servername %>/
+ RewriteEngine On
+ RewriteCond %{HTTPS} !=on
+ RewriteRule (.*) https://%{SERVER_NAME}$1 [R=permanent,L]
<%- end -%>
<%- if default_charset.to_s != 'absent' then -%>
@@ -258,7 +260,9 @@
ProxyPassReverse / http://127.0.0.1/
<%- if ssl_mode.to_s == 'force' then -%>
- Redirect permanent / https://<%= servername %>/
+ RewriteEngine On
+ RewriteCond %{HTTPS} !=on
+ RewriteRule (.*) https://%{SERVER_NAME}$1 [R=permanent,L]
<%- end -%>
<%- if default_charset.to_s != 'absent' then -%>
diff --git a/templates/vhosts/php_wordpress/php_wordpress.erb b/templates/vhosts/php_wordpress/php_wordpress.erb
index 241465f..f30ad91 100644
--- a/templates/vhosts/php_wordpress/php_wordpress.erb
+++ b/templates/vhosts/php_wordpress/php_wordpress.erb
@@ -31,7 +31,9 @@
<%- end -%>
<%- if ssl_mode.to_s == 'force' then -%>
- Redirect permanent / https://<%= servername %>/
+ RewriteEngine On
+ RewriteCond %{HTTPS} !=on
+ RewriteRule (.*) https://%{SERVER_NAME}$1 [R=permanent,L]
<%- end -%>
<%- if default_charset.to_s != 'absent' then -%>
@@ -226,7 +228,9 @@
ProxyPassReverse / http://127.0.0.1/
<%- if ssl_mode.to_s == 'force' then -%>
- Redirect permanent / https://<%= servername %>/
+ RewriteEngine On
+ RewriteCond %{HTTPS} !=on
+ RewriteRule (.*) https://%{SERVER_NAME}$1 [R=permanent,L]
<%- end -%>
<%- if default_charset.to_s != 'absent' then -%>
diff --git a/templates/vhosts/redirect/redirect.erb b/templates/vhosts/redirect/redirect.erb
index 0af8bcb..ba93c46 100644
--- a/templates/vhosts/redirect/redirect.erb
+++ b/templates/vhosts/redirect/redirect.erb
@@ -25,7 +25,9 @@
CustomLog <%= logdir %>/access_log combined
<%- end -%>
<%- if ssl_mode.to_s == 'force' then -%>
- Redirect permanent / https://<%= servername %>/
+ RewriteEngine On
+ RewriteCond %{HTTPS} !=on
+ RewriteRule (.*) https://%{SERVER_NAME}$1 [R=permanent,L]
<% else -%>
Redirect permanent / http://<%= options %>
<%- end -%>
diff --git a/templates/vhosts/static/static.erb b/templates/vhosts/static/static.erb
index 3d3e4ed..18168c1 100644
--- a/templates/vhosts/static/static.erb
+++ b/templates/vhosts/static/static.erb
@@ -29,7 +29,10 @@
AddDefaultCharset <%= default_charset %>
<%- end -%>
<%- if ssl_mode.to_s == 'force' then -%>
- Redirect permanent / https://<%= servername %>/
+ RewriteEngine On
+ RewriteCond %{HTTPS} !=on
+ RewriteRule (.*) https://%{SERVER_NAME}$1 [R=permanent,L]
+
<%- end -%>
<%- if not ssl_mode.to_s == 'force' then -%>
diff --git a/templates/vhosts/webdav/webdav.erb b/templates/vhosts/webdav/webdav.erb
index ad0aba1..a4508b3 100644
--- a/templates/vhosts/webdav/webdav.erb
+++ b/templates/vhosts/webdav/webdav.erb
@@ -31,7 +31,9 @@
<%- end -%>
<%- if ssl_mode.to_s == 'force' then -%>
- Redirect permanent / https://<%= servername %>/
+ RewriteEngine On
+ RewriteCond %{HTTPS} !=on
+ RewriteRule (.*) https://%{SERVER_NAME}$1 [R=permanent,L]
<%- end -%>
<%- if default_charset.to_s != 'absent' then -%>
@@ -226,7 +228,9 @@
ProxyPassReverse / http://127.0.0.1/
<%- if ssl_mode.to_s == 'force' then -%>
- Redirect permanent / https://<%= servername %>/
+ RewriteEngine On
+ RewriteCond %{HTTPS} !=on
+ RewriteRule (.*) https://%{SERVER_NAME}$1 [R=permanent,L]
<%- end -%>
<%- if default_charset.to_s != 'absent' then -%>