While there are a number of online instructions to change Wordpress from HTTP to HTTPS, they are not working for me, probably because my installation is in a subdomain.

Here is the starting situation:

  • The main website is at https://www.example.com with non-HTTP requests being redirected via a 301 to the HTTPS version, same for non-www versions such as http://example.com. Everything here is working as expected. This is NOT a Wordpress site.
  • The Wordpress blog is at http://blog.example.com and worked perfectly as is.

To change Wordpress over to HTTPS, I did a global search for http://blog.example.com and replaced all occurrences by https://blog.example.com both in the files (3 or 4 occurences) and in the database (1000s of occurences). Then added to the .htaccess of the subdomain which is hosted in a subdir (so public_html/blog/.htaccess whereas the site .htaccess is in public_html/.htaccess - all fairly standard configuration):

RewriteCond %{HTTPS} off
RewriteRule ^/?(.*)$ https://blog.example.com/$1 [R=301,L]

The RewriteEngine On line was already there, just one above where the two above were added.

While this has thankfully no impact on the site https://www.example.com, it has the rather unexpected behavior of no longer showing the blog. When accessing https://blog.example.com, the page shows the parent domain's content but not redirected. It still shows https://blog.example.com in the URL bar but the page itself is the same as https://www.example.com.

Just to confirm that those are the only changes made, I reverted and everything went back to normal.

Why does this show the parent domain?

What changes must be made so that https://blog.example.com shows the content currently shown at http://blog.example.com?

  • Is the certificate registered to example.com, blog.example.com or *.example.com ? This makes a difference...
    – Dwev
    Commented Jan 17, 2018 at 18:25
  • It is registered *.example.com but why would that make any difference in which page is shown? Surely, I would expect the right page with a warning if the certificate was not generic enough.
    – Itai
    Commented Jan 17, 2018 at 18:41
  • Ok, I misunderstood the issue originally, but good to know about the cert anyway. :) I think the rules on your main htaccess are likely superseding the one in the sub domain. You have a wildcard redirect there that is probably being processed first and we don’t even get to the subdomain one. Try enabling your subdomain rules again, and disabling the main site rules and see what happens.
    – Dwev
    Commented Jan 17, 2018 at 18:49
  • Thanks but I actually went though that. There are no rules on the main site that would catch the subdomain and I thought having the RewriteEngine on the subdomain meant that ones in parent directories were overriden. Obviously the other rules there are meant to make the Wordpress URLs work and they do when not using HTTPS. In any case, it since the URL does not change, it is not getting a redirect.
    – Itai
    Commented Jan 17, 2018 at 18:54

1 Answer 1


Summarizing the scenario you've outlined in your post and in the comments:

  • SSL Certificate is a wildcard
  • Only the non https version of the subdomain loads
  • HTTPS request forfor the subdomain redirects to the parent domain

This sounds like a vhost configuration issue on the server. Chances are your webserver is missing a vhost for the SSL version of the subdomain.

  1. Check to make sure there is vhost entry for subdomain on port 443, similar to the one for the primary domain.
  2. Once the vhost is added, make sure it is also enabled (if Apache2). You can find an example tutorial of setting one up in this blog post.
  3. If you just added a vhost and enabled it, or just updated an existing one, you'll also need to restart Apache for settings to kick-in.
  • I agree. This sounds like a missing <VirtualHost *:443> ServerName blog.example.com problem. As for the "why this happens", Apache falls back to the default (first) virtual host when it doesn't find a specific matching virtual host. Commented Jan 25, 2018 at 13:00
  • Indeed it is a configuration issue and since this is a hosting platform I cannot know what it is exactly but support basically confirmed it.
    – Itai
    Commented Mar 3, 2018 at 2:32

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.