Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

Change /webmail Redirect for One Domain

Discussion in 'E-mail Discussion' started by orty, Feb 8, 2007.

  1. orty

    orty Well-Known Member

    Joined:
    Jun 29, 2004
    Messages:
    110
    Likes Received:
    0
    Trophy Points:
    166
    Location:
    Bend, Oregon
    cPanel Access Level:
    Root Administrator
    I have a client who is starting to use and outside mail service (google apps for domains, if you must know). They've become accustomed to going to domain.com/webmail to get the webmail login and they're hard folks to re-train, so I'd rather they just keep going there. However, that's hardcoded in httpd.conf server-wide to go to cPanel's webmail login.

    Is there any way I can turn off that redirect for just this one domain so I can just create a webmail folder that has a redirect inside it to their new service's login (which is just http://mail.google.com/a/domain.com)?

    Thanks!
    -orty
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  2. orty

    orty Well-Known Member

    Joined:
    Jun 29, 2004
    Messages:
    110
    Likes Received:
    0
    Trophy Points:
    166
    Location:
    Bend, Oregon
    cPanel Access Level:
    Root Administrator
    ...Anybody?
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. misk0

    misk0 Registered

    Joined:
    Nov 30, 2004
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    151
    Maybe you can try to redefine Alias "/webmail" for that domain within <virtualhost> tags?
     
  4. orty

    orty Well-Known Member

    Joined:
    Jun 29, 2004
    Messages:
    110
    Likes Received:
    0
    Trophy Points:
    166
    Location:
    Bend, Oregon
    cPanel Access Level:
    Root Administrator
    In case anybody else is trying this, I put this in that particular domain's VirtualHost declaration:

    Code:
    ScriptAlias /webmail /home/user/public_html/email/index.cgi
    ScriptAliasMatch ^/webmail/(.*) /home/user/public_html/email/index.cgi
    So basically, I'm redirecting /webmail to a folder called "email" that has index.cgi in it. I'm basically copying the above code from the top of the httpd.conf file as that's what cPanel uses for its redirect for /webmail:
    Code:
    ScriptAlias /webmail /usr/local/cpanel/cgi-sys/wredirect.cgi
    ScriptAliasMatch ^/webmail/(.*) /usr/local/cpanel/cgi-sys/wredirect.cgi
    Inside that index.cgi file, I have a simple perl script that redirects to the proper page:
    Code:
    #!/usr/bin/perl
    use CGI; 
    my $q = CGI->new(); 
    print $q->redirect( 
      -location => 'http://mail.google.com/a/domain.com', 
      -status => 302,
    ); 
    
    So far it seems to work. Thanks!
    (edited this entry as I initially posted that it didn't work, but I had a typo in my perl code)
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
    #4 orty, Feb 12, 2007
    Last edited: Feb 12, 2007
  5. SageBrian

    SageBrian Well-Known Member

    Joined:
    Jun 1, 2002
    Messages:
    416
    Likes Received:
    2
    Trophy Points:
    318
    Location:
    NY/CT (US)
    cPanel Access Level:
    Root Administrator
    cool. Thanks.

    So, this would likely be a way to create a server wide redirect I assume.

    I'm thinking of offering an alternative webmail option, with more customized options, and to get around that pesky port issue for those behind firewalls.

    I'm planning on setting up Squirrelmail on an account, give it an SSL cert (self-signed might be good enough). This allows for access to mail thru port 80, and allows me to add and tweak features of SquirrelMail that wouldn't get over-written with a cpanel update.

    Code:
    ScriptAlias /supermail /home/supermail/public_html/email/index.cgi
    ScriptAliasMatch ^/supermail/(.*) /home/supermail/public_html/email/index.cgi
    
    


    Code:
    #!/usr/bin/perl
    use CGI; 
    my $q = CGI->new(); 
    print $q->redirect( 
      -location => 'https://supermail.hostname.com', 
      -status => 302,
    );
    I knew someone would share a solution.
    Thanks buddy.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  6. iLLuSi0nS

    iLLuSi0nS Active Member

    Joined:
    Jun 9, 2007
    Messages:
    43
    Likes Received:
    0
    Trophy Points:
    156
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice