Title: Custom HTTPS port support
Last modified: August 19, 2016

---

# Custom HTTPS port support

 *  [piotrekm](https://wordpress.org/support/users/piotrekm/)
 * (@piotrekm)
 * [15 years, 11 months ago](https://wordpress.org/support/topic/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](https://wordpress.org/support/users/macmanx/)
 * (@macmanx)
 * [15 years, 11 months ago](https://wordpress.org/support/topic/custom-https-port-support/#post-1509894)
 * I’m not sure, but maybe this will help?
 * [http://codex.wordpress.org/Administration_Over_SSL#Rewrite_for_sites_running_on_port_443_or_port_80](http://codex.wordpress.org/Administration_Over_SSL#Rewrite_for_sites_running_on_port_443_or_port_80)
 *  [vacek37](https://wordpress.org/support/users/vacek37/)
 * (@vacek37)
 * [15 years, 6 months ago](https://wordpress.org/support/topic/custom-https-port-support/#post-1510278)
 * I am second to the [@piotrekm](https://wordpress.org/support/users/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.
 *  [Justin Korn](https://wordpress.org/support/users/themonko/)
 * (@themonko)
 * [15 years, 5 months ago](https://wordpress.org/support/topic/custom-https-port-support/#post-1510282)
 * 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.
 * Thanks!
 *  [vacek37](https://wordpress.org/support/users/vacek37/)
 * (@vacek37)
 * [15 years, 5 months ago](https://wordpress.org/support/topic/custom-https-port-support/#post-1510283)
 * 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.
 *  [Justin Korn](https://wordpress.org/support/users/themonko/)
 * (@themonko)
 * [15 years, 5 months ago](https://wordpress.org/support/topic/custom-https-port-support/#post-1510284)
 * 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.
 * *sigh*
 * I’ll post if I figure anything out and hope others will as well.
 *  [erick_paper](https://wordpress.org/support/users/erick_paper/)
 * (@erick_paper)
 * [15 years, 3 months ago](https://wordpress.org/support/topic/custom-https-port-support/#post-1510305)
 * 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)](https://wordpress.org/support/users/ipstenu/)
 * (@ipstenu)
 * 🏳️‍🌈 Advisor and Activist
 * [15 years, 3 months ago](https://wordpress.org/support/topic/custom-https-port-support/#post-1510306)
 * From: [http://codex.wordpress.org/Editing_wp-config.php](http://codex.wordpress.org/Editing_wp-config.php)
 * > **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', 'ftp.example.org');
       define('FTP_SSL', false);
       ```
   
 *  [erick_paper](https://wordpress.org/support/users/erick_paper/)
 * (@erick_paper)
 * [15 years, 3 months ago](https://wordpress.org/support/topic/custom-https-port-support/#post-1510307)
 * Doesn’t work. Whether I keep FTP_SSL true or false, I see this message:
 *     ```
       Failed to connect to FTP Server ftp.mydomain.com:21
       ```
   
 * 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?
 *  [Clayton James](https://wordpress.org/support/users/claytonjames/)
 * (@claytonjames)
 * [15 years, 3 months ago](https://wordpress.org/support/topic/custom-https-port-support/#post-1510308)
 * > 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)](https://wordpress.org/support/users/ipstenu/)
 * (@ipstenu)
 * 🏳️‍🌈 Advisor and Activist
 * [15 years, 3 months ago](https://wordpress.org/support/topic/custom-https-port-support/#post-1510309)
 * 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.

 * In: [Requests and Feedback](https://wordpress.org/support/forum/requests-and-feedback/)
 * 10 replies
 * 7 participants
 * Last reply from: [Ipstenu (Mika Epstein)](https://wordpress.org/support/users/ipstenu/)
 * Last activity: [15 years, 3 months ago](https://wordpress.org/support/topic/custom-https-port-support/#post-1510309)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
