views:

46

answers:

1

I want to redirect the sub-domain webmail to /roundcube for that domain. This have to work for all virtual hosts in apache.

Example:

webmail.example.com must point to [www.]example.com/roundcube

How is this possible? The server where it has to be done is configured with direct admin :S

+2  A: 

mod_rewrite is your friend.

Try something like this in your Apache VirtualHost configuration:

RewriteEngine on
RewriteCond   %{HTTP_HOST}                 ^webmail\.[^.]+\.[^.]+$
RewriteRule   ^webmail\.([^.]+)\.([^.]+)$  http://www.$1.$2/roundcube  [R=permanent]

...and configure DNS to point webmail.example.com to the same server as www.example.com.

smokris