The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Disable or Redirect /webmail/ for one domain

Discussion in 'E-mail Discussions' started by jer2eydevil88, May 27, 2009.

  1. jer2eydevil88

    jer2eydevil88 Member

    Joined:
    Mar 14, 2006
    Messages:
    20
    Likes Received:
    0
    Trophy Points:
    1
    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/
    
     
  2. SageBrian

    SageBrian Well-Known Member

    Joined:
    Jun 1, 2002
    Messages:
    415
    Likes Received:
    2
    Trophy Points:
    18
    Location:
    NY/CT (US)
    cPanel Access Level:
    Root Administrator
    Wouldn't it be easier to edit the DNS record and point webmail.mydomain to the 3rd party?
     
  3. rporto

    rporto Member

    Joined:
    Jan 29, 2004
    Messages:
    10
    Likes Received:
    0
    Trophy Points:
    0
    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
     
  4. InstaCarma_Tech

    InstaCarma_Tech Well-Known Member

    Joined:
    Apr 22, 2009
    Messages:
    228
    Likes Received:
    1
    Trophy Points:
    18
    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
     
Loading...

Share This Page