view modules/apache/templates/vhost/_rewrite.erb @ 0:956e484adc12

Initial public release of Puppet configs
author IBBoard <dev@ibboard.co.uk>
date Sat, 16 Aug 2014 19:47:38 +0000
parents
children 37675581a273
line wrap: on
line source

<%- if @rewrites -%>
  ## Rewrite rules
  RewriteEngine On
  <%- if @rewrite_base -%>
  RewriteBase <%= @rewrite_base %>
  <%- end -%>

  <%- [@rewrites].flatten.compact.each do |rewrite_details| -%>
    <%- if rewrite_details['comment'] -%>
  #<%= rewrite_details['comment'] %>
    <%- end -%>
    <%- if rewrite_details['rewrite_base'] -%>
  RewriteBase <%= rewrite_details['rewrite_base'] %>
    <%- end -%>
    <%- if rewrite_details['rewrite_cond'] -%>
      <%- Array(rewrite_details['rewrite_cond']).each do |commands| -%>
        <%- Array(commands).each do |command| -%>
  RewriteCond <%= command %>
        <%- end -%>
      <%- end -%>
    <%- end -%>
    <%- Array(rewrite_details['rewrite_rule']).each do |commands| -%>
      <%- Array(commands).each do |command| -%>
  RewriteRule <%= command %>
      <%- end -%>

    <%- end -%>
  <%- end -%>
<%- end -%>
<%# reverse compatibility %>
<% if @rewrite_rule and !@rewrites -%>
  ## Rewrite rules
  RewriteEngine On
<% if @rewrite_base -%>
  RewriteBase <%= @rewrite_base %>
<% end -%>
<% if @rewrite_cond -%>
<% Array(@rewrite_cond).each do |cond| -%>
  RewriteCond <%= cond %>
<% end -%>
<% end -%>
  RewriteRule <%= @rewrite_rule %>
<%- end -%>