Configure roundcube login by hostname

I recently installed Roundcube on my Centos6/postfix/dovecot server.

Default install works great but I am trying to configure some options that I cannot seem to figure out.

My end result would be a user hits:

http://domainname1.com/mail

http://domainname2.com/mail

or

http://mail.domainname1.com

http://mail.domainname2.com

I have set

$rcmail_config['include_host_config'] = true;

in my main.inc.php and created domainname1.inc.php and domainname2.inc.php

I changed the following in each

$rcmail_config['default_host'] = array('domainname1.com');

$rcmail_config['default_host'] = array('domainname2.com');

I'm not sure of anything Else I would need to change.

Any help on this would be greatly appreciated


Required behaviour is controlled by the next RoundCube options:

$config['username_domain'] = '%n';

// Supported replacement variables:
// %h - user's IMAP hostname
// %n - hostname ($_SERVER['SERVER_NAME'])
// %t - hostname without the first part
// %d - domain (http hostname $_SERVER['HTTP_HOST'] without the first part)
// %z - IMAP domain (IMAP hostname without the first part)
// For example %n = mail.domain.tld, %t = domain.tld

You can force use of host domain instead of any manually entered @domain.tld by defined above with:

$config['username_domain_forced'] = true;