Hi guys,

I'm having a problem and maybe somebody might be able to help out with
that. I have a plain simple erb template which I'm basically using for
writing out my vhost files for apache2. Using mod_rewrite I want to control
the redirect based on aliaes assigned to the vhost:

-------------------------------8<---------------------------------
RewriteCond %{HTTP_HOST}   ^vhost\.alias1\.tld [OR]
RewriteCond %{HTTP_HOST}   ^vhost\.alias2\.tld
RewriteRule ^/(.*)         http://target.website.tld/$1 [L,R=301]
------------------------------->8---------------------------------

Using this snippet works just fine but trying to cover it within an erb
template while iterating over an array of possible aliases turned out to be
much more complex then I first thought... ;)

Using the following erb snippet ...

-------------------------------8<---------------------------------
[...]
  <% if has_variable?("vhostaliaes_regex") then %>
  <% vhostaliases_regex.each do |Alias| %>
  RewriteCond %{HTTP_HOST}  <%= Alias %> [OR] <% end %>
  RewriteRule ^/(.*)  http://<%= servername %>/$1 [L,R=301]
  <% end %>
[...]
------------------------------->8---------------------------------

... will result in the following output:

-------------------------------8<---------------------------------
RewriteCond %{HTTP_HOST}   ^vhost\.alias1\.tld [OR]
RewriteCond %{HTTP_HOST}   ^vhost\.alias2\.tld [OR]
RewriteRule ^/(.*)         http://target.website.tld/$1 [L,R=301]
------------------------------->8---------------------------------

Because of the additional '[OR]' parameter at the end of the second line an
endless loop is being created crashing all vhosts. Does anybody have an
idea on how to deal with this?

Thanks :)

Cheers
- Jan

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to