: Can WordPress accept HTTP and HTTPS connections on the same blog? While working on the transition from HTTP to HTTPS, I have configured all websites to accept both HTTP and HTTPS connections.
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.
More posts by @Odierno851
2 Comments
Sorted by latest first Latest Oldest Best
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.
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() {
return
(!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.
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2025 All Rights reserved.