Redirects

Very mini-how-to for doing redirects with Aegir CMS 1.0 RC1

Because Midgard overrides the apache RedirectMatch directive, when using Aegir
one must create the equivalent funtionality.

Context for example:

trying to redirect all www.site.org/mailman/* requests
to lists.site.org/mailman/*

0. Login to Aegir as the admin user.

1. Create a new page (mailman) by clicking on the
on www.site.org and then ‘New’ and then use the
the ‘Subpage’ area to create a page called ‘mailman’.

2. Set the newly created page to ‘Active’ by
clicking on the page then ‘Edit’ then ‘Details’.
Set the ‘Style:’ to ‘/Empty(Shared)’.  For the
‘Authentication:’ select ‘active’.

3. Create a new page element under the ‘mailman’ page
by clicking on the mailman page and then ‘New’ and
then in the ‘Page element’ area enter the text ‘code-init’.
(four elements are called automatically by midgard in the
following order: code-compat,code-global,code-init and ROOT.)

4. Click on the page-element and then ‘Edit’. Add the following
php code to the page-element

<?php

$i = 0;
$path = ‘/mailman’;
while ($i <= $argc)
{
$path = $path.”/$argv[$i]”;
$i++;
}
header(“location: http://lists.site.org$path”);
exit();

?>

For more information about this step, please refer to
http://www.midgard-project.org/manual/en/part.concepts.midgardserved.php

Conclusion

This will now mimic the effect of an apache RedirectMatch
that reads,

RedirectMatch /mailman(.*) http://lists.site.org/mailman$1