Apache 将子域重定向到/文件夹

Apache 将子域重定向到/文件夹,apache,unix,config,Apache,Unix,Config,我想将子域webmail重定向到该域的/roundcube。这必须适用于apache中的所有虚拟主机 例如: webmail.example.com必须指向[www.]example.com/roundcube 这怎么可能?必须执行此操作的服务器配置了直接管理员:Smod_rewrite是您的朋友 在ApacheVirtualHost配置中尝试以下操作: RewriteEngine on RewriteCond %{HTTP_HOST} ^webmail\.[

我想将子域webmail重定向到该域的/roundcube。这必须适用于apache中的所有虚拟主机

例如:

webmail.example.com必须指向[www.]example.com/roundcube


这怎么可能?必须执行此操作的服务器配置了直接管理员:S

mod_rewrite
是您的朋友

在Apache
VirtualHost
配置中尝试以下操作:

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

…并将DNS配置为将
webmail.example.com
指向与
www.example.com
mod_rewrite
是您的朋友相同的服务器

在Apache
VirtualHost
配置中尝试以下操作:

RewriteEngine on
RewriteCond   %{HTTP_HOST}                 ^webmail\.[^.]+\.[^.]+$
RewriteRule   ^webmail\.([^.]+)\.([^.]+)$  http://www.$1.$2/roundcube  [R=permanent]
…并将DNS配置为将
webmail.example.com
指向与
www.example.com
相同的服务器