diff options
-rw-r--r-- | manifests/init.pp | 2 | ||||
-rw-r--r-- | templates/site.erb | 3 |
2 files changed, 4 insertions, 1 deletions
diff --git a/manifests/init.pp b/manifests/init.pp index 6b7b382..9e9f43f 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -191,7 +191,7 @@ class apache { $comment = '', $sshkey = absent, $groups = '', $shell = '/bin/false', $manage_user = true, $ssl = false, $listen = '*', $https_redirect = false, - $canonical = false) { + $canonical = false, $canonical_exceptions = '') { $vhost = $filename ? { '' => "$title", diff --git a/templates/site.erb b/templates/site.erb index 586b158..911d97a 100644 --- a/templates/site.erb +++ b/templates/site.erb @@ -26,6 +26,9 @@ </IfModule> <% end %> <% if canonical != false %> + <%- for canonical_exception in canonical_exceptions -%> + RewriteCond %{HTTP_HOST} !=<%= canonical_exception %> [NC] + <%- end -%> RewriteCond %{HTTP_HOST} !=<%= canonical %> [NC] RewriteCond %{HTTP_HOST} !="" RewriteRule ^/(.*) <%= protocol %>://<%= canonical %>/$1 [L,R=301] |