Following another question I just solved, I wonder: is there anything we can do within Apache to avoid repeating lines of configuration? What about outside apache? In my case it would be AWS EC2's RHEL4, but I trust any **nix* would have a similar solution. Maybe something like sed, maybe using .htaccess... Dunno. But this should be pre-processed, nothing at runtime or something: just like the conf files, once apache is loaded that is it.

@ceztko I don't even remember why I accepted the other one or which solution I've actually used back 1 year ago... I never got properly paid by this project and didn't use apache since. But clearly I haven't tested this one, so I couldn't have said it worked as nicely as its description made me think it would. Anyways, thanks for the kind words! :-)
– cregoxMay 7 '12 at 13:58

Here's a link to a nice tutorial on M4: linuxjournal.com/article/5594?page=0,0 and a more comprehensive one here: mbreen.com/m4.html . The official m4 manual, like most GNU documentation, is almost useless as an introductory material - after scrolling through 10 pages of text you're at the section which conveniently informs you that "François Pinard took over maintenance of GNU m4 in 1992". You need to consume the next 15 screens of text to only be able to write and invoke a simple macro, but you'll know all its obscure invocation options. Talk about first things first...
– Aleksander AdamowskiJun 9 '11 at 8:54

@Aleksander: thanks for the link. And the GNU docs bit is so true most of the time.
– Eduardo IvanecJun 9 '11 at 14:41

Things like this can be done with management frameworks like Puppet or Capistrano. In these scripts are created to generate httpd.conf files (and associated include files) based on defined conditions. These sorts of routine "do this one thing X places" actions can be functionialized. I don't believe there are out-of-the-box methods for doing this kind of thing, but these frameworks are designed to allow you to make your own.