Home » SSL / HTTPS » Mixed Content Errors: Find the HTTP Files Breaking Your HTTPS Page
Mixed Content Errors: Find the HTTP Files Breaking Your HTTPS Page
Your site has a valid certificate and loads over HTTPS, but the padlock is missing, replaced by a warning, or part of the page is broken. The page itself came over a secure connection; some of the files it asks for did not. That combination is called mixed content.
Browsers handle it in two ways:
- Scripts, stylesheets, iframes, fonts and form targets loaded over HTTP are blocked. Styles vanish, sliders stop, embedded videos disappear.
- Images, video and audio loaded over HTTP are upgraded to HTTPS automatically where possible. If the HTTPS version does not exist, they fail to load, and the padlock may show a warning.
Step 1: list the offending URLs
Open the page, press F12 and look at the Console. Each problem appears as a message like:
Mixed Content: The page at 'https://example.com/' was loaded over HTTPS, but requested an insecure script 'http://example.com/js/slider.js'. This request has been blocked.
The URL at the end is what you need to fix. Check several page types (homepage, a post, a page, a category) because each uses different templates and content.
For a whole site, a crawler or an online checker such as "Why No Padlock" or JitBit's SSL check lists every insecure URL across many pages.
Step 2: sort by where the URL comes from
| Where the URL lives | How to fix |
|---|---|
| Your own domain in post content | Search and replace http://yourdomain with https://yourdomain in the database |
| Theme or plugin template files | Edit the file, or update the theme or plugin |
| Theme options / page builder settings | Re-save the setting with HTTPS, or replace in the database |
CSS files (background images, @import, fonts) |
Edit the CSS |
| Third-party resource that supports HTTPS | Change the URL to https:// |
| Third-party resource with no HTTPS | Host the file yourself or find an alternative |
Step 3: update your own URLs in bulk
For WordPress, WP-CLI replaces URLs safely, including inside serialised settings:
wp search-replace 'http://example.com' 'https://example.com' --all-tables --dry-run
Check the counts, then run it again without --dry-run. Back up the database first. Plugins like Better Search Replace do the same from the dashboard.
Also confirm Settings → General uses https:// for both addresses. Many themes build asset URLs from these values.
Step 4: check CSS and JavaScript files
Mixed content inside stylesheets is easy to miss because it does not appear in the page source. Search your theme folder:
grep -rn "http://" wp-content/themes/your-theme --include=*.css --include=*.js
Change each match to https://, or to a root-relative path like /images/bg.jpg for files on your own site.
Step 5: add a safety net
Once the main fixes are in, add this header so any stragglers are upgraded:
Content-Security-Policy: upgrade-insecure-requests
It does not fix resources that simply do not exist over HTTPS, so keep checking the Console after changes.
Common mistakes
- Fixing the homepage and assuming every page is clean.
- Running a search-and-replace on the raw SQL file, which corrupts serialised data.
- Forgetting caching: purge page caches, optimisation plugins and the CDN after fixing.
- Changing
http://to//(protocol-relative). It works, buthttps://is clearer and avoids surprises.
Frequently Asked Questions
What is the difference between active and passive mixed content?
Active content such as scripts, stylesheets and iframes can change the page, so browsers block it outright. Passive content such as images, audio and video is lower risk; modern browsers try to load it over HTTPS automatically and block it if that fails.
Is there a header that fixes mixed content automatically?
The Content-Security-Policy directive upgrade-insecure-requests tells browsers to request HTTP resources over HTTPS. It helps, but only if the resource is actually available over HTTPS. Fix the URLs too.
The padlock is fine on the homepage but not on some posts. Why?
The HTTP links are in those posts' content, such as images inserted before the site moved to HTTPS, or embeds pasted from another site.
Found a mistake or still stuck? Contact us. See how we write and check these guides in our editorial policy, or read about DocumentGuy.