Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

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!

share|improve this question
add comment

2 Answers

up vote 2 down vote accepted

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!

EDIT
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
  </Directory>
</VirtualHost>

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.

share|improve this answer
    
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 Jul 3 '12 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. –  mickburkejnr Jul 5 '12 at 8:17
    
Excellent - I think I'll give the second option a shot. Thanks! –  James Jul 7 '12 at 23:26
    
Did what I say work? –  mickburkejnr Jul 9 '12 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 Jul 12 '12 at 7:58
add comment

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

Alias /webmail /path/to/your/roundcube

As we put this not into a ... 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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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