0

Migrating a site from HTTP to HTTPS. All images have previously been updated using HTTP so the site is full of mixed content warnings.

What is the best way of sorting this? I've not managed to find any plugins or efficient ways of doing this across the whole site.

0

It's a fairly common issue when you update your WordPress site's URL from HTTP to HTTPS or if you are migrating to a new domain. While the WordPress (home) and Site (siteurl) address have been updated to the new HTTPS link:

Updating your home and site URL

However, that doesn't mean that your SSL structure in your posts will be fixed. This results in some of your pages pointing to your HTTP link instead, AKA "getting mixed content warnings".

SSL mixed content issue (grey lock)

Try one of the two options:

1. Third-party: Search/Replace DB

There's a third-party tool tool that allows you

  1. Go and download Interconnect IT's Database Search & Replace Script here
  2. Unzip the file and drop the folder in your localhost where your WordPress is installed (the root) and rename the folder to replace (screenshot)
  3. Navigate to the new folder you created in your browser (ex: http://web.site/replace) and you will see the search/replace tool
  4. It should be pretty self-explanatory up to this point: enter your old URL in the search for… field and the new URL in the replace with… field

2. Plugin: Search & Replace

If you don't have access to your website's source (via FTP, etc.) you can perform the same function by using the Search & Replace plugin within your WordPress site. The process is easy to use and you can also preview what tables and rows will be affected before applying those changes.

Edit: Michael Cropper

For those using the plugin route, I had to use the "Replace Domain URL" option to change from http://web.site to https://web.site, then download the SQL file, then upload this via phpMyAdmin. As always, backup DB before you do this as while this worked for me, may require a few tweaks for yourself.

|improve this answer|||||
  • Are you aware of a plugin that automates this? – Michael Cropper Aug 22 '16 at 21:05
  • I do: Search & Replace. It's does the same thing, but in WordPress with a nice UI. Updated my answer. – Ethan Jinks O'Sullivan Aug 22 '16 at 21:08
  • You are a genius. Thanks very much. Just going to tweak your answer for more specifics related to that plugin for others using that plugin too. – Michael Cropper Aug 22 '16 at 21:20
  • Great. Your comment shows up. Glad that helped. – Ethan Jinks O'Sullivan Aug 22 '16 at 21:24
  • It's not a good idea to run SQL queries like that on the database; raw queries will will break serialized data in the database, i.e. break widget data, theme options, etc. Use interconnectit.com/products/… . What is the link to the "Search and Replace" plugin? Your links only link an image, not a plugin. – markratledge Aug 23 '16 at 0:57
-1

It does not matter what protocol was used to upload the images originally. You simply need to update the method used to request the assets in your HTML.

If the images (or other assets) are available via an HTTPS request then simply update your code to use HTTPS in the request. If you are using WordPress functions such as the_post_thumbnail() to display a featured image, WordPress will automatically use HTTPS for the image once you update the URLs in settings.

Always ensure a good, tested backup exists and perform this work locally or in a dev environment first instead of taking down your production site.

Several good posts on the topic out there for more general info: https://crowdfavorite.com/avoid-ssl-mixed-content-errors-in-wordpress/

|improve this answer|||||
  • Tried adding the code recommended on that link to the wp-config.php file, no luck unfortunately. – Michael Cropper Aug 22 '16 at 21:04

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.