Disable or Redirect /webmail/ for one domain

jer2eydevil88

Member
Mar 14, 2006
20
0
151
We have a client that uses a third party email solution and would like to redirect the mydomain.com/webmail/ forwarder to this third party solution.

Is there any easy way to do this? I have already tried the following htaccess file and creating a physical folder with a php redirect file. Neither worked.

Code:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^mail.mydomain.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.mail.mydomain.com$
RewriteRule ^.*$ "https\:\/\/mydomain\.theemailhostingsite\.com" [R=301,L]

RewriteCond %{HTTP_HOST} ^mydomain.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.mydomain.com$
RewriteRule ^webmail\/?(.*)$ "https\:\/\/mydomain\.theemailhostingsite\.com\/$1" [R=301,L]

Redirect /webmail/ https://mydomain.theemailhostingsite.com/
 

SageBrian

Well-Known Member
Jun 1, 2002
413
2
318
NY/CT (US)
cPanel Access Level
Root Administrator
We have a client that uses a third party email solution and would like to redirect the mydomain.com/webmail/ forwarder to this third party solution.
Wouldn't it be easier to edit the DNS record and point webmail.mydomain to the 3rd party?
 

rporto

Member
Jan 29, 2004
10
0
151
Hi,

I have a similar problem. My client also uses a third party email solution and I created a webmail.domain.com CNAME to webmail.thirdparty.com but when one calls the URL webmail.domain.com, instead of redirecting to the third party webmail server, cPanel shows it's own webmail login.

BTW, I didn't forgot the trailing dot after webmail.thirdparty.com.

I'll appreciate any clue about this.

Cheers,
Ricardo
 

InstaCarma_Tech

Well-Known Member
Apr 22, 2009
227
1
68
Try this to make webmail.domain.com to work :

1. Create an ‘A’ record for the sub-domain ‘webmail’ in the DNS zone file. It should look like :

Code:
domain.com. IN A XX.XX.XXX.XXX
    localhost.domain.com. IN A 127.0.0.1
    domain.com. IN MX 0 domain.com.
    mail IN CNAME domain.com.
    www IN CNAME domain.com.
    ftp IN A XX.XX.XXX.XXX
    cpanel IN XX.XX.XXX.XXX
    whm IN A XX.XX.XXX.XXX
    webmail IN A XX.XX.XXX.XXX
    webdisk IN A XX.XX.XXX.XXX
2. Put the following code inside .htaccess in the sub-domain folder ( virtual sub-domain which doesn’t have an entry in httpd.conf

Code:
 RewriteEngine on
    RewriteCond %{HTTP_HOST} ^webmail.domain.com$ [OR]
    RewriteCond %{HTTP_HOST} ^www.webmail.domain.com$
    RewriteRule ^.*$ “http\:\/\/domain\.com\/webmail” [R=301,L]
To prevent forwarding of ‘/webmail’ to cPanel’s webmail interface , follow the steps below :

1. Open /usr/local/cpanel/APACHE_CONFIG in your favorite editor.

2. Find the lines that reference /webmail

3. Add the following to the beginning of each line that contains /webmail:

*REMOVE*

( Make certain there is a space after the final * )

4. Save your changes and exit the editor

5. Execute /scripts/check_cpanel_apache_aliases

Users can still access cPanel's webmail via ports 2095/96