Redirecting traffic to a https site
Posted
by
Saif
on Server Fault
See other posts from Server Fault
or by Saif
Published on 2012-03-23T21:05:57Z
Indexed on
2012/03/23
23:32 UTC
Read the original article
Hit count: 201
apache2
|mod-rewrite
In our mail server there are multiple virtual email domain hosted. User can use webmail.example.com (this is the first apache virtualhost) to check mail or they can use mail.THEIR-DOMAIN.com. If the put mail.THEIR-DOMAIN.com apache shows the webmail.example.com as it is the first virtualhost and mail.THEIR-DOMAIN.com doesn't exist. Recently we imposed https for webmail.example.com and added this mod_rewrite rule:
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
But now users not getting the default webmail page as they were getting before. How can we redirect all request coming to the URL "mail.ANY-DOMAIN.com" to "https://webmail.example.com"? I've tried the following but it didn't work:
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (mail.*) https://webmail.example.com
Thanks for your help in advance.
© Server Fault or respective owner