Loading...

Knowledge Base
Up to 75% off on hosting for WordPress websites and online stores

How to Fix Mixed Content Errors on Bluehost Cloud

A website utilizing HTTPS but presenting security warnings or broken images may indicate a mixed content error. This happens when a secure site loads images, scripts, or links through an insecure HTTP connection. This guide will assist you in identifying and fixing mixed content errors on Bluehost Cloud to ensure your site remains secure and operates smoothly.

What is a Mixed Content Error?

A mixed content error occurs when a website loaded over a secure HTTPS connection tries to load resources (like images, scripts, or stylesheets) over an insecure HTTP connection. This can result in an "unsecured connection" warning for visitors and may impact the website's security and user experience.

While mixed content errors often appear in media items like images, videos, or scripts, they can also affect other elements, such as SEO meta data. For example, if your site uses HTTPS but refers to HTTP content, this could trigger a mixed content error.

Bluehost Cloud Hosting automatically forces all websites to use HTTPS. Still, if you are experiencing mixed content errors, it's important to identify and fix the issue.

Identify Mixed Content Errors

There are a few ways to check for mixed content errors:

  • Use an SSL Checker—Tools like Why No Padlock can help you identify if Force HTTPS is active and show any mixed content errors. Note that these tools do not check SEO meta data.
  • Inspect the Website's Source Code—You can check for mixed content directly in your website's code using your browser's Inspect feature. For example, if an image is broken, right-click on it and select Inspect. This will show the reference URL in the console. Verifying that the URL starts with HTTPS (not HTTP) and matches the expected location would be best.
  • Check Google Search Console or XML Sitemap—Review the URLs in your Google Search Console or XML Sitemap. They should match your WordPress Site URL. If any URLs listed there still use HTTP instead of HTTPS, they could be causing the mixed content error.

Fix Mixed Content Errors

To resolve a mixed content error, you must update the URLs from HTTP to HTTPS. Here's how you can do it:

Option 1: Using WP-CLI (Preferred Method)

  1. Connect to Your Website via SSH—Log in to your website's server using SSH (Secure Shell) to run the WP-CLI commands.
  2. Run a Dry Run SearchUse the following command to perform a dry run (a test) to see what changes will be made:
    wp search-replace [oldurl] [newurl] --all-tables --dry-run
    • Replace [oldurl] with the URL causing the mixed content error (for example, http://bluehost.com).
    • Replace [newurl] with your WordPress Site URL (for example, https://bluehost.com).

    This will show you how many URLs will be updated. If it says "0" changes, double-check the [oldurl] to ensure it matches the URL causing the error.

  3. Run the Command Without --dry-run—Once you're confident that the URLs are correct, rerun the command without the --dry-run option to replace the URLs:
    wp search-replace [oldurl] [newurl] --all-tables
    
  4. Clear the cache with the wp-cli command—After updating the tables, run the following command to ensure that any cached content is cleared, and the updated content is reloaded in the browser:
    wp cache flush
    This command clears all caches used by WordPress, ensuring that your changes appear immediately on the site without being blocked by old cached content.
  5. Recheck Your Site—After updating the URLs, recheck your website to ensure the mixed content errors are resolved. You can recheck it using the same method you used to identify the issue (e.g., using SSL checkers or inspecting the website).

    Note: After updating your WordPress database and clearing the cache, you can further ensure that your site loads the most up-to-date content by adding a random query string to the URL in your browser. For example:

    yourdomain.ext/?123

    By appending /?123 (or any other random string) to the end of the URL, the browser will treat it as a new request, bypassing the cache and forcing the site to load the freshest data. This is a quick way to confirm that the changes are immediately visible without waiting for the cache to refresh automatically.

Option 2: Using a Plugin (Alternative Method)

In case you're not comfortable using WP-CLI, you can opt for a plugin to assist with searching and replacing. However, we recommend WP-CLI since it eliminates the need for temporary plugins that might slow down your site.

Some popular plugins for this task include:

  • Better Search Replace
  • Search & Replace

After installing the plugin, search for any old HTTP URLs and replace them with the correct HTTPS URLs.

Summary

Mixed content errors are common but can be easily resolved by updating URLs from HTTP to HTTPS. WP-CLI is the preferred method for fixing mixed content issues, but plugins can also be an option. By following the steps above, you can ensure that your Bluehost Cloud website remains secure and that your visitors are not shown any warnings about unsecured connections.

If you need further assistance, feel free to contact us via Chat or Phone:

  • Chat Support - While on our website, you should see a CHAT bubble in the bottom right-hand corner of the page. Click anywhere on the bubble to begin a chat session.
  • Phone Support -
    • US: 888-401-4678
    • International: +1 801-765-9400

You may also refer to our Knowledge Base articles to help answer common questions and guide you through various setup, configuration, and troubleshooting steps.

Did you find this article helpful?

 
* Your feedback is too short

Loading...