Skip to main content

WordPress: How to Fix Mixed Content Warnings After Forcing HTTPS

This article will walk you through how to identify and fix mixed content warnings in WordPress after enabling HTTPS.

Justin Catello avatar
Written by Justin Catello
Updated this week

When you force your website to use HTTPS, you might encounter mixed content warnings caused by resources like images, scripts, or stylesheets still being loaded over HTTP. These warnings can affect your site's security and user experience. In this article, we’ll walk you through how to identify and fix mixed content issues to ensure all elements of your website are securely loaded over HTTPS.

  1. If you access your website in a browser and see errors like the ones below in the console section, it means that some resources—such as images, scripts, or stylesheets—are still being loaded over HTTP.

    Mixed Content: The page at 'https://testing.shared-test.com/' was loaded over HTTPS, but requested an insecure element 'http://new.shared-test.com/testing.jpg'. This request was automatically upgraded to HTTPS, For more information see https://blog.chromium.org/2019/10/no-more-mixed-messages-about-https.html

  2. To identify the source of the issue, we need to search through the website's web files. You can use the following command in SSH to locate where the HTTP resources are being referenced.

    grep -lr 'http://new.shared-test.com'

  3. Here, we found that the code is located in the index.html file and is loading resources insecurely over HTTP. To fix this, you can use the shared command below to update those references to HTTPS.

    sed -i 's|http://new.shared-test.com|https://new.shared-test.com|g' index.html

  4. If we had identified more files containing insecure URLs, we could use the command below to update all of them across all directories.

    find ./ -type f -exec sed -i -e 's|http://new.shared-test.com|https://new.shared-test.com|g' {} \;

  5. Now, when checking in the browser's console section, we no longer see any insecure warnings or errors.



    Congratulations! You’ve successfully resolved mixed content warnings on your website and ensured all resources are securely loaded over HTTPS.

    If you have any questions, please don’t hesitate to contact our team via live chat.

    For technical inquiries, please feel free to reach our support team by emailing support@bigscoots.com from your registered email or by submitting a support ticket.

Did this answer your question?