Rather than providing a text area for aliases, then a check-box to turn these aliases into redirects, why not provide two text areas - one for aliases and one for redirects? We have many situations where we would like both. Not 100% sure how widely applicable our Aegir use-cases are, but I suspect they are fairly mainstream.

Note from the Aegir maintainers:

This issue overlaps with:


realityloop’s picture

+1 I was asking mig5 about this just the other day, and this is exactly what I had in mind :)

anarcat’s picture

To answer your question ("why not?"): because it was easier that way. :)

I do not object making that change, but do keep in mind the current UI is very easy to use, and adding that feature will make it much more complicated, not sure it's worth the tradeoff unless it's really done right...

I guess having two textareas is simple enough. :)

obrienmd’s picture

Strangely, the users I've talked to are confused by the current setup (maybe because they are more technically-minded)... The idea of an "either/or" doesn't make sense to them when aliases and redirects are two different things. Typical case: A user wants a few alias subdomains so multiple http requests can be made for css, js, etc, but redirects from others so that all actual user-viewed pages are on a consistent subdomain (for SEO). Does that make any sense?

anarcat’s picture

The more I look at this form, the more I feel you guys are right and having two boxes just makes sense. I would welcome a patch.

obrienmd’s picture

I'm happy to patch the form / variable storage... but w/ my IT chops, I'm not quite sure how to attach the backend. If anyone wants to build off my work on the UI, let me know and I'll work something up!

obrienmd’s picture

OK, I'm going to give this a shot. Off to #aegir to ask for mentoring :)

obrienmd’s picture

Project:Hosting» Hostmaster (Aegir)

Moving this over to hostmaster. Here's my current working theory on an approach:

I don't think changing the database structure is the best approach, so i'm thinking to remove the checkbox, add a textarea for redirects in its place, the change the alias add/update logic to run the existing INSERT stuff for each $node->aliases and $node->redirects, but hardcode redirection column to 0 for aliases and 1 for redirects.

In theory, this _should_ maintain compatibility with everything else, as long as the provision stuff can handle both redirects and aliases on a single site.

I'd welcome thoughts in the next few hours before I start hacking away at this!

anarcat’s picture

This is exactly what needs to happen.

obrienmd’s picture

Worked on this a bit over the weekend, but it might be a while... This is over my head and I'm learning a lot!

One thing that might be a showstopper (and I'm going from memory here, don't have the code in front of me) is that the drush code seems to hand the entire site off with one toggle for redirect or aliased... So there may have to be some patching on the provision side of things as well.

I'm also struggling with how to handle the automated www, non-www, and subdomain stuff in the context of this change. The www/non-www stuff could just be radio buttons (auto www: none, aliased, redirected.... auto non-www: none, aliased, redirected), but not quite sure how to handle the subdomain stuff.

Any input would be much appreciated!

anarcat’s picture

My gut feeling is that the automatic aliases should have the same UI as the site aliases. That is, we would have one hosting-wide setting for "automatic redirects" and another for "automatic aliases".

As for the IPC between hosting and provision, I expected that to change, to be honest, so that's not a big problem. :)

jgabor’s picture

Could this potentially solve the problem I've discussed with myself here?

obrienmd’s picture

jgabor: Even as it stands, the redirect feature will solve your problem (as long as you don't also want aliases). If I ever get my hacking to work, you'll have the ability to do both :)

Robin Millette’s picture


Steven Jones’s picture

Version:6.x-0.4-alpha3» 6.x-2.x-dev
omega8cc’s picture

@obrienmd - any progress on this feature?

obrienmd’s picture

@omega8cc - unfortunately, haven't got back to hacking on this... it's a much-needed feature, I'm sure I'll try again this year if it doesn't show up, once the project load comes down in a few months

anarcat’s picture

Note that this overlaps with #1681904: Ability to configure a url to redirect to in site configuration., but i think this should be done first.

Steven Jones’s picture

Issue summary:View changes

Updated issue summary.

matglas86’s picture

Maybe you guys are helped with a use-case of mine that is related to this.

When I setup a site in Aegir it gets its site name, e.g. example.com. This will be the tld. Then I want my site visitors only go to the www. version of my site. To do this now I need to set my site name to www.example.com and add example.com as a alias.

Next to that, when someone enters through demo.example.com it should be catched too and be redirected to www.example.com.

For my cdn purpose I want an alias that serves my css/images files etc. This will be available on cdn.example.com. Now we need to be sure that it does not redirect to www.example.com because that defeats the purpose.

I hope this helps in getting closer to the solution.

obrienmd’s picture

#18: That's the use case we're all talking about. Basically, one text area for Redirect and another for Subdomain + Alias (which are the same).

omega8cc’s picture

@matglas86 note that you can get separate vhost created for fake (local) CDN support with this module: http://drupal.org/project/provision_cdn - so you have at least last item on your list fixed. The first two need separate aliases and redirects feature. I think I will work on this next month (Nov).

tourtools’s picture

Hello, this would be an awesome feature (the one to separate aliases from redirects), there is any progress on this?

tourtools’s picture

Issue summary:View changes

Updated issue summary.

ergonlogic’s picture

Version:6.x-2.x-dev» 7.x-3.x-dev
Issue summary:View changes

New features need to be implemented in Aegir 3.x, then we can consider back-porting to Aegir 2.x.

samuelsov’s picture

As mentionned here, it is possible to do all sort of customization in the vhost in a aegir context.

For example, if you need to have several distinct domains for the same drupal instance but want one domain to be redirected to the main domain, you could set the Redirect all domain aliases to: No redirection in aegir and add the single redirection in a module with a file my_module.drush.inc that implement hook_provision_apache_vhost_config like that :

function my_module_provision_apache_vhost_config($uri, $data) {
// the uri to check here is the name of the site in Aegir
if ($uri === "www.example.org") {
$rval[] = "";
$rval[] = "# Forces redirect to specific uri";
$rval[] = "RewriteEngine On";
$rval[] = "RewriteCond %{HTTP_HOST} ^(www.)?otherdomain.org$ [NC]";
$rval[] = "RewriteRule ^(.*)$ http://www.example.org$1 [R=301,L]";
$rval[] = "";

The module can be created in /var/aegir/.drush/ for example.

Still, it can be difficult to maintain and errors are possible, so i would rather do it within aegir.
But the UI will not be able to handle every possible cases.