Hi Nan, On 10/25/2011 07:57 PM Nan Liu wrote:
[...] >> 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? > > Try vhostaliases_regex.collect{ |val| "RewriteCond %{HTTP_HOST} > #{val}"}.join(" [OR]\n") > >> vhostaliases_regex = ['alias1', 'alias2'] > => ["alias1", "alias2"] >> val = vhostaliases_regex.collect{ |val| "RewriteCond %{HTTP_HOST} >> #{val}"}.join(" [OR]\n") > => "RewriteCond %{HTTP_HOST} alias1 [OR]\nRewriteCond %{HTTP_HOST} alias2" >> puts val > RewriteCond %{HTTP_HOST} alias1 [OR] > RewriteCond %{HTTP_HOST} alias2 > => nil why things cannot be always that easy.. that's the snippet of erb code I made up: --------------------------------8<--------------------------------------- <% if vhostaliases_regex != "" then -%> <% vhostaliases_new = vhostaliases_regex.collect{ |val| "RewriteCond %{HTTP_HOST} #{val}"}.join(" [OR]\n ") %> <% vhostaliases_new.each do |Alias| %><%= Alias %><% end %> RewriteRule ^/(.*) http://<%= servername %>/$1 [L,R=301] <% end -%> -------------------------------->8--------------------------------------- Thanks :) - Jan
signature.asc
Description: OpenPGP digital signature