开发者

Redirect subdomain to /folder

开发者 https://www.devze.com 2022-12-15 14:24 出处:网络
I want to redirect the sub-domain webmail to /roundcube for that domain. This have to work for all virtual hosts in apach开发者_开发知识库e.

I want to redirect the sub-domain webmail to /roundcube for that domain. This have to work for all virtual hosts in apach开发者_开发知识库e.

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


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消