Support » Requests and Feedback » Custom HTTPS port support

  • I would like to see the support for custom HTTPS ports in WordPress, as I have my vhost SSL port set to the non-default value.

    I managed to somewhat modify its code to get FORCE_SSL_LOGIN work this way.

    Here is the change I made:

    In file wp-includes/link-template.php, in function site_url, starting from line 1756:

    $url = str_replace( 'http://', "{$scheme}://", get_option('siteurl') );
    //beginning of custom code
            if ( ($scheme == 'https') && defined('SSL_CUSTOM_PORT') )
                    $url .= ':'.SSL_CUSTOM_PORT;
    //end of custom code
            if ( !empty($path) && is_string($path) && strpos($path, '..') === false )
                    $url .= '/' . ltrim($path, '/');

    With this modification I can login over SSL with SSL_CUSTOM_PORT set, but it would be great to see FORCE_SSL_ADMIN working with non-default ports too.

    Any help would be appreciated.

    (Also, I was quite uncertain whether to post it here or in the “Plugins and Hacks” forum, I hope this is the good place for it)

Viewing 10 replies - 1 through 10 (of 10 total)
  • Moderator James Huff


    Volunteer Moderator 🚀

    I am second to the @piotrekm request. Currently, there is no easy option to force WordPress to use any other SSL port.

    Running WP in my development environment I got many Virtual Hosts on the same server, and the default SSL port 443 is already used by some other software. Of course you got the same trouble if you want to run multiple WP with SSL on a production machine, which could be a big problem.

    WP should be adapted to use a customer-defined SSL port in all the HTTPS links it generates. At the moment the software can not do that.

    Is there any solution for this? I’m facing the same issue right now, trying to setup 2 instances of WP on a production server, both of which I want to protect the admin section with SSL.

    Proving to be very difficult.


    I tried to play with WP code, but it was too time consuming. Unfortunately, there is no single place to modify the SSL URLs, or at least I did not discover it.

    After a few hours I gave up, moving another system to a non-default SSL port and allowing WP to get the control of HTTPS:443

    Hopefully, WP guys will take care of that one day.

    Thanks, vacek37.

    I thought I could take the easy way out and just assign a wildcard certificate (as both WP instances are in the same domain with different subdomains). However, that didn’t seem to go well. Wonder if I’m creating the certificate wrong or assigning it wrong.

    I’m digging in the WordPress code a bit right now as well and not coming up with much as of yet.


    I’ll post if I figure anything out and hope others will as well.

    Hey, any update on this?

    Inside the WordPress admin, when I “ftp” and choose https, it doesn’t work as the SFTP in my server is a non-standard port.

    How does that work? An easy port number setting in wp-config.php will be lovely!

    Moderator Ipstenu (Mika Epstein)


    🏳️‍🌈 Halfelf Rogue & Plugin Review Team Rep


    FTP_HOST is the hostname:port combination for your SSH/FTP server. The default FTP port is 21 and the default SSH port is 22, These do not need to be mentioned.

    FTP_SSL TRUE for SSL-connection if supported by the underlying transport, Not available on all servers. This is for “Secure FTP” not for SSH SFTP.

    So add these to your wp-config.php

    define('FTP_HOST', '');
    define('FTP_SSL', false);

    Doesn’t work. Whether I keep FTP_SSL true or false, I see this message:

    Failed to connect to FTP Server

    Why is it looking for port 21 regardless of SSL port being true or not?

    Also, SFTP is the most common protocol on most servers that I know of. When it is going to be supported?

    Also, SFTP is the most common protocol on most servers that I know of

    I think sftp might be file transfer over ssh – not the same as ftps, which is ftp transfer over ssl/tls.

    Two different animals.

    WordPress supports file transfer over SSH. You just have to have the php ssh2 extension enabled on your server. Then you will see the new choice to transfer using ssh in the “ftp – ftps” selection area in the dashboard.

    Moderator Ipstenu (Mika Epstein)


    🏳️‍🌈 Halfelf Rogue & Plugin Review Team Rep

    Correct, Clayton.

    And these are supported per server. If your server turned it off (mine did), then you can’t do it :/ You may want to check with your host.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Custom HTTPS port support’ is closed to new replies.