How to redirect webmail HTTP to HTTPS

Created:

2016-11-16 13:18:06 UTC

Modified:

2017-08-21 20:09:01 UTC

19

Was this article helpful?


Have more questions?

Submit a request

How to redirect webmail HTTP to HTTPS

Applicable to:

  • Plesk 12.5 for Linux
  • Plesk Onyx for Linux

Question

How to redirect webmail from HTTP to HTTPS?

Answer

Connect to the server using SSH.

Solution 1

  1. Create a configuration file with the following content:

    # touch /etc/httpd/conf/plesk.conf.d/webmails/roundcube/redirect.conf
    # cat /etc/httpd/conf/plesk.conf.d/webmails/roundcube/redirect.conf
    RewriteEngine On
    RewriteCond %{HTTPS} off
    RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

  2. Restart Apache:

    # service httpd restart

    It will create a redirect for Roundcube webmail. For Horde, create the same file in /etc/httpd/conf/plesk.conf.d/webmails/horde/

Solution 2

  1. Plesk 12.x or older

    Create a custom template:

    # mkdir -p /usr/local/psa/admin/conf/templates/custom
    # cp -p /usr/local/psa/admin/conf/templates/default/domainWebmail.php /usr/local/psa/admin/conf/templates/custom/

    add the following to the end of the custom domainWebmail.php file:

    CONFIG_TEXT: RewriteEngine On
    RewriteCond %{HTTPS} off
    RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

  2. Plesk Onyx:

    # mkdir -p /usr/local/psa/admin/conf/templates/custom/webmail
    # cp -p /usr/local/psa/admin/conf/templates/default/webmail/webmail.php /usr/local/psa/admin/conf/templates/custom/webmail/

    add the following right above the first </VirtualHost> string of the custom webmail.php file:

    CONFIG_TEXT: RewriteEngine On
    RewriteCond %{HTTPS} off
    RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

    Reconfigure all domains:

    # /usr/local/psa/admin/sbin/httpdmng --reconfigure-all

Have more questions? Submit a request
Please sign in to leave a comment.