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.

Redirecting /webmail for a specific account

Discussion in 'E-mail Discussions' started by NetShapersInc, Aug 1, 2012.

  1. NetShapersInc

    NetShapersInc Member

    Joined:
    Apr 13, 2012
    Messages:
    22
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    Hi guys,

    I want to redirect /webmail for a specific account.

    To put it into perspective, we are a web development company who also hosts email for clients, and about half of our clients are on our cPanel box, and the other half are still on a colocated box. For the colo email clients, they would hit our domain: domain.com/webmail. We migrated our site to our cPanel box, and now the older clients can't use the webmail link (due to them not being migrated to the cPanel box).

    Is there any way that we can choose not to forward them to the cPanel webmail link if the request is coming from that domain? I've searched endlessly on this forum and have not been able to find out any details that worked in our application.

    Please note we own the WHM box so any manual file changes that need to be done can be done.

    Server:
    WHM 11.32.3 (build 23)
    CENTOS 6.3 i686 VPS Optimized3
     
  2. cPanelTristan

    cPanelTristan Quality Assurance Analyst
    Staff Member

    Joined:
    Oct 2, 2010
    Messages:
    7,623
    Likes Received:
    21
    Trophy Points:
    38
    Location:
    somewhere over the rainbow
    cPanel Access Level:
    Root Administrator
    You would need to remove the ScriptAliasMatch line toward the top of /usr/local/apache/conf/httpd.conf and then configure it on a per VirtualHost basis using include. The line looks like the following:

    Code:
    ScriptAliasMatch ^/?webmail/?$ /usr/local/cpanel/cgi-sys/wredirect.cgi
    After removing the line, copy a backup of httpd.conf, distill the changes, rebuild it and restart it:

    Code:
    cp /usr/local/apache/conf/httpd.conf /usr/local/apache/conf/httpd.conf.bak120801
    /usr/local/cpanel/bin/apache_conf_distiller --update
    /scripts/rebuildhttpdconf
    /etc/init.d/httpd restart
    At that point, try adding the line to /usr/local/apache/conf/userdata/std/2/username locations for individual accounts that need it. You'll have to create the path /usr/local/apache/conf/userdata/std/2/username and replace username with the cPanel username. You'll also have to create another one in /usr/local/apache/conf/userdata/ssl/2/username location. The file could be named webmail.conf or whatever you prefer ending in .conf

    We have documentation on using includes such as these at this location:

    Changes Contained within a VirtualHost Directive

    Thanks!
     
  3. NetShapersInc

    NetShapersInc Member

    Joined:
    Apr 13, 2012
    Messages:
    22
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    Tristan, one quick question -- how can I do a AddType line into the root apache config? I want to parse HTML through PHP, (run PHP files that are marked as .htmls), and I needed to do this with the login form.

    Is there any way to do this?
     
  4. cPanelTristan

    cPanelTristan Quality Assurance Analyst
    Staff Member

    Joined:
    Oct 2, 2010
    Messages:
    7,623
    Likes Received:
    21
    Trophy Points:
    38
    Location:
    somewhere over the rainbow
    cPanel Access Level:
    Root Administrator
    You would be better off adding this to /usr/local/apache/conf/includes/pre_virtualhost_global.conf file. You can see the syntax you would use for an AddType in /usr/local/apache/conf/php.conf file.

    Please do not place the AddType into /usr/local/apache/conf/php.conf file itself, as that file is wiped whenever EasyApache is recompiled and the PHP handler is selected (or whenever you change the PHP handler in WHM > Apache Configuration > PHP and SuExec Configuration area).

    Thanks!
     
  5. NetShapersInc

    NetShapersInc Member

    Joined:
    Apr 13, 2012
    Messages:
    22
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    Tristan,

    It still does not seem to be working. I put this line in the pre_virtualhost_global.conf: "AddType application/x-httpd-php .php .php3 .php4 .php5 .html", ran the distiller, rebuilt the httpd.conf file, and restarted apache, but to avail.

    Any ideas on what could cause this? I even put it in the php.conf file just to see if it'd actually work, and that didn't either.
     
  6. cPanelTristan

    cPanelTristan Quality Assurance Analyst
    Staff Member

    Joined:
    Oct 2, 2010
    Messages:
    7,623
    Likes Received:
    21
    Trophy Points:
    38
    Location:
    somewhere over the rainbow
    cPanel Access Level:
    Root Administrator
    What do you have in your php.conf file itself? Please post the contents.
     
  7. NetShapersInc

    NetShapersInc Member

    Joined:
    Apr 13, 2012
    Messages:
    22
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    Or with the extra line:

     
  8. cPanelTristan

    cPanelTristan Quality Assurance Analyst
    Staff Member

    Joined:
    Oct 2, 2010
    Messages:
    7,623
    Likes Received:
    21
    Trophy Points:
    38
    Location:
    somewhere over the rainbow
    cPanel Access Level:
    Root Administrator
    You'll have to revise the existing line instead:

    AddType application/x-httpd-php .php5 .php4 .php .php3 .php2 .phtml .html

    Otherwise, you can just try adding it as an include with only .html for the line in the include you are trying. If pre_virtualhost_global.conf doesn't work, go ahead and try the other include files one by one to see which does work.

    Of note, you only need to restart Apache. You don't have to distill or rebuild it when using /usr/local/apache/conf/includes files. Those are already included in httpd.conf by default.
     
Loading...

Share This Page