Mario. Web Developer, Snowboarding Addict

Aegir: custom apache config per site

I wanted to add custom apache config to one of my Aegir managed sites recently.

The Aegir handbook has a tip on injecting into site vhosts. It's pretty straightforward to extend this to work for specific sites:

<?php
    function mario_provision_apache_vhost_config($uri, $data) {
        if ($uri == 'mario.net.au') {
            return array(
                "RewriteCond %{HTTP_HOST} mario\.net\.au$ [NC]",
                "RewriteRule ^/f(.*)$ /sites/mario.net.au/files/f$1 [L]"
            );
        }
    }
?>

Now you've got site specific custom apache conf that Aegir won't blow away every time you do something!

And more?

Comments

Thanks for this, came in handy. But I did notice its missing a closing bracket.

Fixed!

Add new comment

Filtered HTML

  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd> <img> <div> <h3> <h4>
  • Lines and paragraphs break automatically.
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>, <bash>, <drupal5>, <drupal6>, <javascript>, <php>, <text>.
  • Web page addresses and e-mail addresses turn into links automatically.

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.