Posts disappearing after ssl migration

I have inherited the management of a website for a new client, and am completely new to working with Sage. The site is hosted by Digital Ocean on an nginx webserver, and whilst I can fumble around a Linux vps, working on the command line is not one of my strong points!! The client asked for a ssl certificate to be installed and I followed a tutorial to get a free LetsEncrypt certificate installed using certbot.

All appeared to go well, and certbot changed the nginx server config to enforce ssl. The site is working on the whole, but the client contacted me to say that one page had gone missing and was throwing a 404 and that several Posts were no longer showing up on the blog page, or indeed in Wordpress Admin.

I installed a backup plugin and performed a quick database sql dump and I can see the Posts at least in the database sql. I have also performed a database search and replace to change all the urls to https, so I have absolutely no idea what the cause of this could be?

The only thing I can actually see that might be still amiss is that in Wordpress Admin the Site url and WP Address are still listed as http and greyed out. More through trial and error I discovered that these are define in the application.php for the Sage theme, but hardcoding these to the actual urls resulted in the site completely failing to load!!!

Anyway, the client is now getting very twitchy and I am at a complete loss, so any help will be gratefully received.

Thanks,

Jeremy

OK, after digging a bit more Im not sure this is actually to do with ssl!! However, the incorrect Wordpress and Site urls still need to be resolved if someone could help with that?

Since you mentioned application.php… is the site running on Bedrock? If there is a composer.json file in the root of the project and application.php resides in a folder named config, you probably are and if the composer.json file has "name:" "roots/bedrock" in it you most definitely are.

If so, maybe this will help: there is a .env file in the root of your project where, if not already done, you can change the value of WP_HOME to start with https instead of http.

Make sure to undo your hardcoded URLs in application.php.

You may also need to add $_SERVER['HTTPS'] = 'on'; to application.php (or, if you don’t run https in all environments, the files in config/environments that corresponds to the https-environments).

Thank you! Yes, it would appear to be running on Bedrock and I have found the .env file. All https configuration is now correct. Slowly getting my head around how everything works

The ‘loss’ of Posts turned out to be the de-registration of some Custom Post types…goodness knows how that happened, but all has now been recovered…one client happy again, and one very relieved web designer!

This topic was automatically closed after 42 days. New replies are no longer allowed.