How to redirect webmail from HTTP to HTTPS on a Plesk for Linux server

Follow

Comments

14 comments

  • Avatar
    João Alves

    Hi!

     

    I've followed the solution 2.2 (Onyx) without luck.

    I've also restarted the services after the reconfigure.

    apache2.service

    nginx.service

    plesk.phpxx.fpm.service

     

    Can you help please?

  • Avatar
    João Alves

    Please ignore, I've inserted the code below, not above </virtualhost>.

     

    my bad, it's working

  • Avatar
    Lev Iurev

    @João Alves Glad to know:)

  • Avatar
    João Alves (Edited )

    Thank you for this how to !

     

    Regards

  • Avatar
    Ralph Jäger

    Adding this line works for me obtaining the Let's Encrypt certificate

    ProxyPass /.well-known/acme-challenge/ !

     

  • Avatar
    Jeffrey Zeunert

    Thank you for this article. I was able to make this redirect and experienced no downtime for my client's sites. I'm wondering, however, if creating the Plesk configuration template undid configuration changes I made probably in httpd.conf file? DirectoryIndex changed and loads html files first whereas it had been loading php files first.

     

  • Avatar
    Ivan Postnikov

    @Jeffrey Zeunert

    Hello!

    This is expected behavior.

    Applying configuration template deletes all changes done manually in Apache/Nginx configuration files.

  • Avatar
    Nucleus Inc. NOC

    I think the best solution to this would have a checkbox on the "mail settings" page for domains to enable 301 redirect when applying a SSL cert, just like there is on the "hosting settings" page.

     

    Please vote for this!

    https://plesk.uservoice.com/forums/184549-feature-suggestions/suggestions/31900489-redirect-from-http-to-https-for-secured-webmails

    it will fix all these problems without admins having to mess around in config files that could get overwritten by updates.

  • Avatar
    Christopher Smith

    In Solution 3 for Roundcube below you should really add the $config['force_https'] = true; to  /usr/share/psa-roundcube/config/config.inc.php instead so that if you do an update it won't be overwritten.

    Solution 3: Using native configuration file of Roundcube/Horde

     

    For Plesk: Roundcube webmail

    1. Connect to a Plesk server via SSH.

    2. Open the file /usr/share/psa-roundcube/config/defaults.inc.php in any text editor and change the value of "$config['force_https']" to "true":

      $config['force_https'] = true;

    3. Save the changes and close the file.

  • Avatar
    Pavel Mikhaylov

    Hi Christopher,

    Thanks for your input. I added it to the article.

  • Avatar
    Jeffrey Zeunert

    I had done this webmail redirect back in February and see that now it no longer works. I tried to redo this and am getting an error "no such file or directory" when i try to copy it to the newly created folder. Have the locations changed since this article was written?

  • Avatar
    Alisa Kasyanova

    @Jeffrey

    Please re-check the path. On the screenshot I see that you have created the /usr/local/psa/admin/conf/templates/webmail folder, not the /usr/local/psa/admin/conf/templates/custom/webmail one.

  • Avatar
    Jeffrey Zeunert

    Thank you Alisa. That worked once I created the second folder.

  • Avatar
    Bernhard

    For me all of the 3 suggested solutions did not work (ubuntu 18.04) together with Lets Encrypt!

    The problem:

    If you try to secure the domain with lets encrypt and you also want to include "webmail.yourdomain.com" in the certificate, you'll get an error that one or more additional domains have not been secured... I've tried all 3 solutions and it's the same for all. As soon as I disabled the HTTP to HTTPS redirect for webmail, the cert issued without any errors.

    My solution: I changed the RewriteCond to this:

    RewriteCond %{REQUEST_URI} !\.well-known/acme-challenge

Please sign in to leave a comment.

Have more questions? Submit a request