Redirecting /webmail to a HTML file

Hammo91

Member
Jul 31, 2019
6
1
3
Australia
cPanel Access Level
Root Administrator
We would like to redirect the /webmail URL for a specific cPanel user account to a HTML file (e.g. /public_html/webmail.html).

I have read through some of the documentation on how to edit the VirtualHost files, however we are running CloudLinux so some of the paths do not seem to exist on our server.

Can anybody assist me with redirecting /webmail?
 

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
15,235
2,423
363
cPanel Access Level
Root Administrator
There is not a native feature to change the webmail redirect. The only way to perform that work would be to make manual edits to the Apache template files on the system that are outlined here:

https://forums.cpanel.net/threads/how-change-the-webmail-url-in-proxy-subdomains.383512/

while also taking into account the changes made to EasyApache 4 here:

https://documentation.cpanel.net/display/EA4/Advanced+Apache+Configuration

Could you try making those adjustments and then let us know how it goes?
 

Hammo91

Member
Jul 31, 2019
6
1
3
Australia
cPanel Access Level
Root Administrator
Sorry for the delayed response. I have attempted to follow the links you have sent me, however the redirect is not working.

I copied /var/cpanel/templates/apache2_4/ea4_main.default to /var/cpanel/templates/apache2_4/ea4_main.local and edited the following lines:

Code:
ScriptAliasMatch ^/?webmail$ /usr/local/cpanel/htdocs/webmail.html
ScriptAliasMatch ^/?webmail/ /usr/local/cpanel/htdocs/webmail.html
The webmail.html file simply contains a meta refresh line which should redirect the user to a new URL.

I then ran the following commands as per the other thread (one command did not work):

/usr/local/cpanel/bin/apache_conf_distiller --update (THIS COMMAND DID NOT WORK)
/usr/local/cpanel/bin/build_apache_conf
/scripts/restartsrv_httpd

Now when I navigate to https://<domain>.com/webmail, I receive a 500 Internal Server Error.