2012
06.26
06.26
I’m wondering since ages why doesn’t WordPress support custom port number.
For a while I’m using my own method to avoid this limitation, but finally I created a patch, and submitted to the WordPress core trac here: #21077.
The patch in text mode is here:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | # diff -Naru ms-settings.orig ms-settings.php --- ms-settings.orig Tue Jun 26 09:41:13 2012 +++ ms-settings.php Tue Jun 26 09:50:44 2012 @@ -30,6 +30,10 @@ } elseif ( substr( $domain, -4 ) == ':443' ) { $domain = substr( $domain, 0, -4 ); $_SERVER['HTTP_HOST'] = substr( $_SERVER['HTTP_HOST'], 0, -4 ); + } else if( defined( 'WP_CUSTOM_PORT' ) && substr( $domain, 0 - ( strlen( WP_CUSTOM_PORT ) + 1 ) == ':' . WP_CUSTOM_PORT ) ) { + $colonpos = 0 - ( strlen( WP_CUSTOM_PORT ) + 1 ); + $domain = substr( $domain, 0, $colonpos ); + $_SERVER['HTTP_HOST'] = substr( $_SERVER['HTTP_HOST'], 0, $colonpos ); } else { wp_load_translations_early(); wp_die( __( 'Multisite only works without the port number in the URL.' ) ); |
To get it working you will also need a WP_CUSTOM_PORT constant to be added to wp-config.php.
Hi,
Thank you for your patch. Unfortunately, I don’t think it works on my 3.4.1 installation. After apply your patch, I still get the error message “ERROR: You cannot install a network of sites with your server address”.
I found out in the wp-admin/network.php, around line 171, it only allows port 80 and 443 to go through.
I’m new to wordpress and php, so I don’t want to blindly by pass that check. Do you have any idea?
Best,
Patrick
Have you guys found a workaround for this problem?
What Patrick said was right.
In the wp-admin/network.php, it only allows port 80 and 443 to go through.
I´ve tried to change and it doesn’t work
Hey Pablo,
In WordPress 3.5 this issue is fixed.
Thank you