While working on the transition from HTTP to HTTPS, I have configured all websites to accept both HTTP and HTTPS connections. This worked for everything except WordPress. There is an option in the WordPress Settings page where one can specify which is the site URL.

Right now the WordPress blog fully works with HTTP. Changing the URL to use HTTPS breaks the site, so it will require some debugging and work. So, if there any way to make WordPress accept both types of connection? Visitors need the HTTP version until the HTTPS version works, but I need to use the HTTPS version myself in order to debug.

  • Maybe you could set the site URL to be relative. Either just /, or protocol relative //example.com/. This StackOverflow thread says that it appears to work Relative URLs in Wordpress. Some answers have plugin suggestions as well. Sep 19, 2017 at 16:46
  • Here is one from the WordPress StackExchange site: Relative or dynamic site url possible?. One answer has some custom code and the other sets WP_HOME and WP_SITEURL to relative links. Sep 19, 2017 at 16:49

2 Answers 2


First, most sites are moving to exclusively https, so Wordpress concentrates on that. Secondly, the method will be different depending on if you are on a Wordpress.com site or using Wordpress on another hosting platform or if you built the site yourself with Wordpress.org.

Now, if you are on Wordpress.com, then I would suggest contacting their support staff. There are odd limitations when using that platform that do not always apply with other Wordpress websites. They may have plugins, I do not know.

If you used Wordpress.org, you can look for plugins or try adding both http & https to your wp-config.php file. Here's an example from blog.rabin.io:

function isSecure() {
    (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off')
    || $_SERVER['SERVER_PORT'] == 443;

$web_site     = 'blog.rabin.io';
$schema       = isSecure() ? 'https://' : 'http://';
$web_site_url = $schema . $web_site;

define('WP_HOME',    $web_site_url);
define('WP_SITEURL', $web_site_url);

(No, I have not tested this.)

Then if you wanted to you would have to force SSL for the page(s) you want with this (example for login & admin):

define( 'FORCE_SSL_LOGIN', true );
define( 'FORCE_SSL_ADMIN', true );

For a Wordpress site on another hosting platform, I suspect there are plugins for that. Depending on the hoster, you may be able to modify your wp-config yourself.

  • Wordpress I use is their software but hosted on a dedicated server. I can modify wp-config as I wish but I need to know how.
    – Itai
    Nov 16, 2017 at 17:29
  • Look at the wordpress.org support page, they have a good help section to help you edit back end files like the config. That's better than someone else guessing what's currently in your config, what if any limitations are added by your hosting company, WP versions and such.
    – Natali K.
    Nov 19, 2017 at 8:25

Essentially no, although given this is open source software it could be hacked.

The main issue is the instance on using fully qualified paths everywhere. Changing wp-config.php file as @NataliK suggests allows the blog index to be seen with both HTTP and HTTPS protocols but that only goes so far.

What remains is that posts use absolute URLs whenever a link or image is inserted and those are in the DB. When migrating, one has to string-replace all database entries from one protocol to the other, so doing was is suggested results in plenty of mixed content warnings.

Through some code one can conduct the transformation on the fly when extracting database rows but this is a rather complicated task. It is much easier to wait until a full transition can be done.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.