blog/content/posts/2014/01/01/wordpress-https-nonstandard-port.md
2022-06-25 08:47:06 +01:00

825 B

title date tags category
Wordpress and nonstandard ports and protocols 2014-01-01 11:32:36
tls
wordpress
software

I needed to set up a Wordpress installation where https is on nonstandard port and the admin interface lives in that land, while the site itself is using plain http.

In wp-config.php:

if (!empty($_SERVER['HTTPS'])) {
    define('WP_SITEURL', 'https://example.com:12345');
    define('WP_HOME', 'https://example.com:12345');
}
else {
    define('WP_SITEURL', 'http://example.com');
    define('WP_HOME', 'http://example.com');
}

This allows the installation to properly see resources like images and css if accessed via nonstandard port. So if you don't see image previews in the admin panel, your styles look weird, or you just don't see new posts' previewes - this might be it.