Fixing Your Site after Installing an SSL Certificate on WordPress

Sometimes, after adding installing an SSL certificate or migrating a site from one platform to another, it doesn’t behave as expected. There are several fixes for this so, if your site isn’t functioning properly after applying an SSL certificate, read on.

Generally the issues are caused by problems with your page links; that is, links to your site that were listed as http but are now https. Sometimes these slip through the cracks. The three main steps to try are:

  • Running the Really Simple SSL plugin
  • Updating the URLs in the WordPress database
  • Updating the site’s permalinks

Let’s get started.

Run the Really Simple SSL Plugin

This plugin is really simple to use, just like it says! You can install it from the Plugins library, then Activate it.

Once activated you will see a message box like the one below. Just click Go ahead, activate SSL and you’re done! (Yes, there are a few more configuration options but essentially that’s it!)

Update URLs in the WordPress Database

This is a bit more technical because you have to go into the database via PhpMyAdmin and use SQL searches to hunt down any old instances of the HTTP address and replace them with the HTTPS versions. I’ve found that whenever it gets to this stage, the find/replace usually does the trick and it’s one of the first things I check after finding any migration issues.

I usually run a search first to see whether there are any HTTP address lurking in there, and usually there are. To do this:

  1. Click the Search tab in PhpMyAdmin (make sure you’re in the correct database!)
  2. In the Words or values to search for (wildcard: “%”) field, type the search term, in this case the full website address using http://, e.g., http://www.mywebsite.com.
  3. Copy and paste the results into a text file. If you have any instances of the search URL in your database you will want to run the SQL statement to change them.
  4. Rerun the search using the variant of the URL without the www prefix, for example, http://mywebsite.com.
  5. Again, copy the results into a text file so you have a record you can refer. These search results give you the correct table names to use.

Now you’re ready to replace the URLs. The SQL statement to use is:

UPDATE wp_options SET option_value = replace(option_value, 'Existing URL', 'New URL') WHERE option_name = 'home' OR option_name = 'siteurl';

UPDATE wp_posts SET post_content = replace(post_content, 'Existing URL', 'New URL');

UPDATE wp_postmeta SET meta_value = replace(meta_value,'Existing URL','New URL');

UPDATE wp_usermeta SET meta_value = replace(meta_value, 'Existing URL','New URL');

UPDATE wp_links SET link_url = replace(link_url, 'Existing URL','New URL');

UPDATE wp_comments SET comment_content = replace(comment_content , 'Existing URL','New URL');

To use it:

  1. Click the SQL tab in PhpMyAdmin (make sure you’re in the correct database!)
  2. Copy and paste the SQL statement above into the SQL Query field.
  3. Modify the original statement so that it shows your URLs (old and new) and amend the table names, if yours are different.
  4. Click Simulate. Then, if it all looks good, click Go.

That should have changed all the URLs.

Sometimes you’ll have a table or two not covered by the SQL statement above, or there may be another field in the table that is not listed. In that case you’ll need to add additional statements to cover those tables and/or fields. If you’re not happy to do this yourself, contact me for help.

If the above still hasn’t fixed your site, there’s are still two more things to try. Next we’re going to change the permalink settings, then we’ll try reinstalling the template from a download.

Update the Site Permalinks

In the Dashboard, click Settings and then Permalinks. You see a list like the one below.

By default you probably have your site set to use the Post name for links. Whatever setting you have, these are the steps to follow:

  1. Click Plain then Save these amended settings.
  2. Click Visit Site to see whether the sites is back on.
  3. Go back into the Permalink settings, then click Post name (or restore to whatever setting you had before, if different.) Click Save.
  4. Visit the site again. Is it fixed?

If you’re still having issues there’s one more thing to try: deleting and re-installing the WordPress theme. This will create a little more work as all your customisations are likely to disappear, unfortunately, but at least it should get you back up and running again!

The steps for completing that task are in a separate post. Good luck!

More Like This

Do you need someone to maintain your WordPress site?

Whether you’re looking for a monthly maintenance plan or occassional updates, we can help.