Applicable to:
- Plesk for Linux
Question
How to redirect webmail of all domains to a specific webmail URL in Plesk?
Answer
For this solution to work, all domains must use a single webmail client, either Roundcube or Horde.
To enable only one webmail in Plesk, go to Tools & Settings > Webmail and leave only one webmail client enabled.
Warning: It is mandatory for the new URL to be hosted on this Plesk server and to not load from an external IP address.
-
Connect to a Plesk server via SSH
-
Create a directory for custom configuration templates:
# mkdir -p /usr/local/psa/admin/conf/templates/custom/webmail
-
Copy the original file webmail.php to the created directory:
# cp /usr/local/psa/admin/conf/templates/default/webmail/webmail.php /usr/local/psa/admin/conf/templates/custom/webmail/webmail.php
-
Open the file /usr/local/psa/admin/conf/templates/custom/webmail/webmail.php in a text editor. In this example, we are using the vi editor:
# vi /usr/local/psa/admin/conf/templates/custom/webmail/webmail.php
-
Add the lines below before the lines
"<?php echo $VAR->includeTemplate('domain/PCI_compliance.php') ?>"
(there are two of them):Note: Replace example.com with a domain name and webmail.example.com with a webmail URL that will be used as an entry point for all users.
CONFIG_TEXT: <?php
if ($VAR->domain->asciiName !== 'example.com') { echo "Redirect permanent / https://webmail.example.com/"; }
?> -
Save the changes and close the file.
-
Regenerate configuration files for all domains:
Note: During this operation websites will be unavailable for a short period of time. The execution time of this command depends on the number of domains on the server.
# plesk repair web -y
Comments
0 comments
Please sign in to leave a comment.