Quick background case: If I use Softaculous to install WP in cPanel, I can specify which protocol I would like the site to be in... (so they have something that addresses this).

However with my multisite network, whenever I (or a user) creates a new site, the site URL is created exclusively as http protocol, and needs to be updated manually later to https.

So far I have searched high and low and not found anything (code, tutorial or packaged plugin) that does this. Everything I've found focuses on fixing the problem after the fact via redirects and/or find and replace (which is not what this question is about).

In my research I have found wpmu_new_blog... maybe this could be used to set the protocol somehow?

(Incorporating a comment of mine):

Also found What does $scheme in site_url function do?, which references site_url and $scheme, which may be relevant (not sure if this can be incorporated with the wpmu_new_blog action?).

Perhaps these components could be used to create a (hopefully) "simple" mu-plugin file?

I don't know if that is a valid approach, or how these components could be used together, but that is my research has brought so far.

  • If you set up the initial "parent" site as HTTPs right when you install WP, it will automatically create subsites as HTTPS as well. Did you initially create the parent site as HTTP and later change it to HTTPS? – WebElaine Sep 5 '18 at 14:58
  • Hi @WebElaine, I'm not sure! I would have thought so, but it was a while ago... But perhaps not since this is not happening by default. Maybe I can modify some code in the main site WP install to achieve this then? PS - I probably used Softaculous for this, so who knows how they go about this... – Drewdavid Sep 5 '18 at 15:02
  • i've looked for this quite a while too. I ended up changing it manually right after adding each new subsite. I tried to change it in the wpmu_new_blog action but that resulted in ssl errors. – Wilco Sep 5 '18 at 15:06
  • You could try a Rewrite Condition in .htaccess - in the root directory of the parent site - to rewrite everything: stackoverflow.com/questions/20894947/… – WebElaine Sep 5 '18 at 15:31
  • Thanks @WebElaine! I'm not looking for a redirect solution; I already force https for everything I can. :) – Drewdavid Sep 6 '18 at 15:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.