Ask Your Question
1

Best way to manage Rewrite Rules on Apache

asked 2013-02-21 08:35:25 -0500

Hi,

I'm new to Puppet and would like to know the best way to include rewrite rules on my virtual hosts.

The problem is that we manage a large number of domains / sub domains with very specific set of rewrite conds and rewrite rules for each one.

Thanks!

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2013-02-26 08:08:27 -0500

llowder gravatar image

There are a couple different options.

If you keep the rewrite rules in the vhosts, you can add something like:

<% @rewriterules.each do |rr| -%>
<%= rr %>
<% end -%>

to the vhost file, then pass in an array of all your rewrite rules.

If you want to use an conf.d style solution, you add something like include rewrites\<%= @vhsost_name %>.conf to the vhost file, then use a file resource to push out the actual rewrite rules.

We actually use a combination of these two methods.

edit flag offensive delete link more

Comments

Thanks,

We will try this, what worked for us was to create a file with the rewrite rules and include it in the template like this

<%if rewriterules != '' -%> <%= File.open ...(more)

sirgt gravatar imagesirgt ( 2013-03-08 15:02:18 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2013-02-21 08:35:25 -0500

Seen: 804 times

Last updated: Mar 08 '13