WebTrickz
TRENDING
  • How to See Your Liked Posts on Instagram 2022
No Result
View All Result
  • News
  • Reviews
  • Social Media
    • Facebook
    • Twitter
    • YouTube
    • Messenger
    • Instagram
    • Snapchat
    • WhatsApp
    • TikTok
  • Apps
  • How To’s
  • Apple
  • iPhone
  • Google
  • Android
  • Mac
SUBSCRIBE
  • News
  • Reviews
  • Social Media
    • Facebook
    • Twitter
    • YouTube
    • Messenger
    • Instagram
    • Snapchat
    • WhatsApp
    • TikTok
  • Apps
  • How To’s
  • Apple
  • iPhone
  • Google
  • Android
  • Mac
No Result
View All Result
WebTrickz
No Result
View All Result
Home Blogging

How to Change Image URLs from HTTP to HTTPS in WordPress

An easy way to fix mixed content warning in WordPress due to HTTP images.

Mayur Agarwal by Mayur Agarwal
December 27, 2021
in Blogging, How To's

Recently, I moved this website to HTTPS / SSL which is hosted on WordPress CMS. The migration from HTTP to HTTPS went smooth and the permanent redirection to HTTPS was successful too. Soon after propagation, the HTTP pages were redirecting to their HTTPS equivalents and were showing a green padlock sign. The only issue was that most of the HTTPS pages were showing mixed content warnings.

webtrickz https enabled site
WordPress site with HTTPS enabled

Due to such warnings, the pages don’t show a Secure tag aka padlock and instead say that “Your connection to this site is not fully secure” or “This connection is not Private”.

Your connection to this site is not fully secure
An example of mixed content warning in WordPress

This problem arises when the page resources link to HTTP URLs instead of HTTPS, thus labeling them as an insecure element. The mixed content warning is usually caused by images added on pages that are still loading with the HTTP URL. This issue doesn’t stem from the SSL setup itself and is needed to be fixed as a part of the migration process to HTTPS.

I intensely searched through a lot of sources to find a precise way to update image links from HTTP to HTTPS after SSL migration in WordPress. However, I couldn’t find a single guide that could help a first-timer to accomplish this technical task with ease. After much brainstorming and going through a lot of articles, I finally figured out a simple solution to fix not secure error on HTTPS pages.

Guide to Update Images to HTTPS in WordPress

I’ll keep this guide simple and straight to the point so that newbies don’t get confused like me.

We will be using the “Better Search Replace” plugin for WordPress that packs the best features found in similar plugins. You can perform this entire task without logging into phpMyAdmin to run any SQL queries which could mess up your site in case anything goes wrong.

Before proceeding, note that this tutorial is applicable for WordPress users who have set a 301 redirection and are using only the HTTPS protocol on their website or blog. Although this would work in most scenarios, one needs to consider other factors too if the problem persists.

1. Change WordPress Home and Site URL to HTTPS

Go to your WordPress dashboard > Settings > General. Now change the WordPress Address and Site Address URL to HTTPS instead of HTTP. (Refer image)

Wordpress general settings
HTTP to HTTPS redirect in WordPress

This makes WordPress itself handle the redirect. Additionally, all internal links within the WordPress app and website will be set to their HTTPS equivalents. This would state that every bit of the website is, and leads to, encrypted content. Just to be sure, you can add the below rule to your .htaccess file.

RewriteEngine On
RewriteCond %{HTTP:X-Forwarded-SSL} !on
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

This 301 redirect will make sure to redirect any HTTP request to HTTPS.

2. Change Media Assets (Images, Internal links) from HTTP to HTTPS

Coming to the main step. You now need to replace all the old HTTP URLs in the WordPress database with HTTPS. This means updating all the image file links and internal links added manually (in post or pages) to HTTPS in order to prevent any insecure image warning and fix the mixed content error. However, there is no need to update external links pointing to other websites to HTTPS.

WARNING: Make sure to backup your database first.

Replace HTTP to HTTPS with Beter Search Replace Plugin

To proceed, install the “Better Search Replace” WordPress plugin and activate it.

Now head over to the plugin page located under the Tools section. In the “Search for” field enter the HTTP version of your website URL and the HTTPS version in the “Replace with” field. Under select tables, scroll down and select the “wp_posts” table which contains image URLs, and URLs embedded inside posts and pages. Then uncheck the “Run as dry run?” option and hit the Run Search/Replace button.

How to Change Image URL from HTTP to HTTPS in WordPress
Change image URL from HTTP to HTTPS in WordPress with Better Search Replace

Wait for the processing to take place. You can later view details such as the number of changes found and rows updated for the particular table.

better search replace plugin

NOTE: If you get an error during processing, go to the Settings tab and try decreasing the “Max Page Size” value to anywhere around 8000 to 10000.

That’s it! The HTTP version of your website’s embedded links and image URLs should now be updated with the HTTPS version.

To confirm, simply open a blog post and copy the image address within a post or view the page source. The image URLs should now show the HTTPS version and you should now see a Secure padlock next to the address bar.

Images with HTTP link
Before (Image URL)
Images with HTTPS link
After (Image URL)
Internal links with HTTP
Before (Internal Link URL)
Internal Link URL with HTTPS
After (Internal Link URL)

Bonus Tip: After replacing HTTP with HTTPS successfully, you can remove the plugin.

Find why HTTPS site is not showing a green padlock

Do note that some pages with broken or unavailable links such as expired CDN might still result in mixed content. You can identify the insecure elements on such pages by using Inspect Element feature in Chrome or just use whynopadlock.com to easily find out insecure items on your SSL-enabled pages.

Reference: Check this detailed article by Michael Bely

Tags: BloggingTutorialsWordPress
ShareTweetSend
Previous Post

How to Check Airtel Broadband Unused Carry Over Data

Next Post

Facebook friend requests will now expire after 14 days

Mayur Agarwal

Mayur Agarwal

Mayur Agarwal is the founder and editor-in-chief of WebTrickz. As a Technology enthusiast and an Internet addict, he loves sharing useful How To’s and Tips & Tricks.

Next Post

Facebook friend requests will now expire after 14 days

Comments 12

  1. Prashanth says:
    5 years ago

    Thanks for this simple but most useful tips 🙂

    I also made the switch to https yesterday! The installation of SSL was done smoothly by the hosting provider as I bought SSL from them. But I also faced the same issue with Padlock. I requested the hosting provider to look in to this. In the mean time I found your article and tried the plugin my self.

    The plugin was really amazing. It solved my issue with deep linking and images. I only required to manually change one header logo.

    For your Info, I used a different code for 301 redirect.

    Reply
    • Mayur says:
      5 years ago

      Glad to hear that this post helped you. I wrote it for the sole purpose to help everyone who is stuck with this problem and can’t figure out an easy fix to it.

      Reply
  2. Jacqueline Smith says:
    5 years ago

    Thanks very much for this article. I just migrated my https site to a new host and had to purchase a new certificate. Had errors concerning my site. I searched the web and as you mentioned there was nothing that was easy for newbies.
    Carried out the instructions laid out here and my site is up and running.
    Looking at the previous comment, I too had one image that didn\’t get updated. It was the header logo, which I easily fixed by removing it then adding it gain.
    Thank you so much!!

    Reply
    • Mayur says:
      5 years ago

      Glad you found this guide useful. Happy to help 🙂

      Reply
  3. Ross says:
    4 years ago

    Great instruction Mayur. Migrating from HTTP to HTTPS is really pain in the ass.

    Reply
  4. Andy says:
    2 years ago

    Thank you very much. This article saved me some time! 🙂

    Reply
  5. Janus says:
    12 months ago

    Thank you for this simple and great help.

    Reply
  6. Hobie van Huson says:
    11 months ago

    Brother, you just helped a fellow newbie with his image files. And all it took was step #1 and no further. Thank you.

    Reply
  7. simon says:
    9 months ago

    wow thanks for this news very helpful

    Reply
  8. Myrthe says:
    9 months ago

    Thank you so much for this simple solution!!!! Yoohoo!

    Reply
  9. James Curran says:
    8 months ago

    This was super helpful – thank you!

    Reply
  10. Katrina Singh says:
    8 months ago

    This Article Very Helpful Because I dont know how to replace http images to https then i found you article its save my life .. Thank You

    Reply

Leave a Reply Cancel reply

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

Latest Stories

Spotify smart shuffle

How to Turn Off Smart Shuffle on Spotify in 2023

March 15, 2023
do not disturb focus on iphone

iOS 16: How to Turn Off Do Not Disturb on iPhone 14

March 12, 2023
Photo by Dan Nelson on Unsplash

The Importance of Using a VPN for Social Media Users

March 10, 2023

Free and Paid Tools to Compress Video for WhatsApp

March 7, 2023
Photo by Andrea Piacquadio on Pexels

The Impact Of Social Media On Children

March 6, 2023
snapchat logo

How to See Blocked People on Snapchat in 2023

February 28, 2023

Apps to Create an Eye-catching Presentation on Mac

February 28, 2023

TRENDING

  • Facebook saved reels

    How to Find Your Saved and Liked Reels on Facebook

  • How to See Memories on Instagram and Post as Story

  • How to Reply to a Specific Message on Instagram 2022

  • How to Make Spotify Album Art Bigger on iOS 16 Lock Screen

  • 4 Ways to Remove the Floating Home Button on iPhone

Popular Tags

Google Android Chrome

Twitter Dark Mode OnePlus

iPhone Apple Apps Mac

Facebook Messenger Security

Instagram Tutorials Photos

  • About
  • Advertise
  • Contact
  • Privacy Policy

© 2023 WebTrickz. All Rights Reserved.

No Result
View All Result
  • News
  • Reviews
  • Apps
  • How To’s
  • Android
  • Google
  • iPhone
  • Mac
  • Contact Us

© 2023 WebTrickz. All Rights Reserved.