I run Roundcube webmail on my VPS. At the moment, it is only accessible from one virtual server hosted on the server, unless a separate Roundcube installation is created for other virtual servers. I would like to be able to make webmail available from any domain/ virtual server that I host, just by adding /webmail to the end.

I'm sure Apache must allow me to do this - only problem is, I don't know how!

2 Answers 2


It's just a simple 301 redirect. Like so:

RewriteRule http://www.somedomain.com/webmail$     http://www.actualdomain.com/webmail/     [R=301,L]

This goes on the server that has these hosted domains. Then it'll route that traffic to the actual VPS that hosts the webmail client.

By the way, well done in picking Roundcube. I'm using it on my VPS, literally is one of the best webmail clients I've come across!

Another way is to include it in your vhosts file with code similar to this:

<VirtualHost *:80>
    ServerName theirdomain.com/webmail
    ServerAlias www.theirdomain.com/webmail
    DocumentRoot "\where\your\folder\is\"
  <Directory "\where\your\folder\is\">
    IndexOptions +FancyIndexing NameWidth=*
    Options Includes FollowSymLinks Indexes
    AllowOverride All
    Order allow,deny
    Allow from all

I know the .htaccess method would work, I'm not entirely sure if the above vhost code would work as well though as I've never tested it.

  • Thanks - so whereabouts do I put that line? Does it go in the httpd.conf file? Is there not a way to do it automatically, so there's no need to insert the line manually for each new virtual server? And yes - quite like Roundcube! Better than Squirrelmail, anyway.
    – James
    Commented Jul 3, 2012 at 21:08
  • You would put that line in to a .htaccess file. There is another way which I've updated the answer to show, you would put that in to your vhosts file. Commented Jul 5, 2012 at 8:17
  • Excellent - I think I'll give the second option a shot. Thanks!
    – James
    Commented Jul 7, 2012 at 23:26
  • Did what I say work? Commented Jul 9, 2012 at 9:31
  • Annoyingly, I've had problems with Cloudflare, so I haven't been able to set any additional domains to try this out! Hopefully they'll iron out shortly and I'll pop back with the outcome of trying out what you mention.
    – James
    Commented Jul 12, 2012 at 7:58

Put the following into your /etc/apache2/httpd.conf, or wherever user configuration for the main host goes:

Alias /webmail /path/to/your/roundcube

Since we are not placing this into a <VirtualHost> … </Virtualhost> section, it applies to all virtual hosts at the same time. See Apache Alias directive.

Note that it is not possible to use the ServerAlias directive for a solution, as that is for hostnames only, not applicable to directories.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.