I have a archive page which is running under https. It doesn’t loading any images within the post as all the image urls with http.

It is giving an error like bellow,

Blocked loading mixed active content "http://www.example.com/wp-content/uploads/image.jpg"

How should I avoid that errors and load the images on that page.

I saw in a article simplest way to fix it by converting urls into relative urls.

eg:

http://www.example.com/wp-content/uploads/image.jpg -> //wp-content/uploads/image.jpg

Any idea how should I do that ?

5 Answers
5

It’s a fairly common issue when you update your WordPress site’s URL form HTTP to HTTPS or if you are migrating to a new domain. While a partial solution is to update your WordPress’ home and site URL in your settings:

enter image description here

That doesn’t mean that the new URL structure in your posts will be fixed. This results in some of your pages pointing to your HTTP link instead.

As a quick solution that ensures that all of the URLs for your website are up-to-date, use the following SQL query:

SQL Query

UPDATE wp_options SET option_value = replace(option_value, 'OLD_URL', 'NEW_URL') WHERE option_name="home" OR option_name="siteurl";
UPDATE wp_posts SET guid = replace(guid, 'OLD_URL','NEW_URL');
UPDATE wp_posts SET post_content = replace(post_content, 'OLD_URL', 'NEW_URL');
UPDATE wp_postmeta SET meta_value = replace(meta_value,'OLD_URL','NEW_URL');
  • OLD_URL will be replaced with http://example.com (non-HTTP)
  • NEW_URL will be replaced with https://example.com (HTTPS)

Be sure to back up your database before you perform this SQL query in case you run into an issue.

Tags:

Leave a Reply

Your email address will not be published. Required fields are marked *