<% if @redirect_source and @redirect_dest -%>
<% @redirect_dest_a   = Array(@redirect_dest) -%>
<% @redirect_source_a = Array(@redirect_source) -%>
<% @redirect_status_a = Array(@redirect_status) -%>

  ## Redirect rules
  <%- @redirect_source_a.each_with_index do |source, i| -%>
<% @redirect_dest_a[i] ||= @redirect_dest_a[0] -%>
<% @redirect_status_a[i] ||= @redirect_status_a[0] -%>
  Redirect <%= "#{@redirect_status_a[i]} " %><%= source %> <%= @redirect_dest_a[i] %>
  <%- end -%>
<% end -%>
<%- if @redirectmatch_status and @redirectmatch_regexp and @redirectmatch_dest -%>
<% @redirectmatch_status_a = Array(@redirectmatch_status) -%>
<% @redirectmatch_regexp_a = Array(@redirectmatch_regexp) -%>
<% @redirectmatch_dest_a = Array(@redirectmatch_dest) -%>

  ## RedirectMatch rules
  <%- @redirectmatch_status_a.each_with_index do |status, i| -%>
<% @redirectmatch_status_a[i] ||= @redirectmatch_status_a[0] -%>
<% @redirectmatch_regexp_a[i] ||= @redirectmatch_regexp_a[0] -%>
<% @redirectmatch_dest_a[i] ||= @redirectmatch_dest_a[0] -%>
  RedirectMatch <%= "#{@redirectmatch_status_a[i]} " %> <%= @redirectmatch_regexp_a[i] %> <%= @redirectmatch_dest_a[i] %>
  <%- end -%>
<% end -%>
