Fix Mixed Content on HTTPS Websites

You installed an SSL certificate, but the browser still shows an incomplete or warning padlock icon? That's Mixed Content — the most common issue after migrating a site from HTTP to HTTPS. This guide explains what mixed content is, how to detect it, and how to fix it completely for both WordPress and non-WordPress sites.

What is Mixed Content?

Mixed content occurs when an HTTPS page loads some resources — images, scripts, CSS, or iframes — over HTTP (without the S). Modern browsers block or warn users about these resources because HTTP content on an HTTPS page is a security risk.

There are two types of mixed content:

How to Detect Mixed Content

1. Browser Developer Tools

Press F12 → Console and look for warnings starting with "Mixed Content" or "Blocked loading mixed-content". These messages include the exact URL of the problematic resource.

2. Online Tools

Use tools like Why No Padlock (whynopadlock.com) or JitBit SSL Check to scan your page and list all mixed content URLs in one click.

3. Database Search (WordPress)

SELECT * FROM wp_posts WHERE post_content LIKE '%http://%';

Fixing Mixed Content in WordPress

Method 1: Really Simple SSL Plugin

The easiest method for WordPress. The Really Simple SSL plugin automatically handles mixed content by:

Method 2: Update WordPress URLs in Settings

Go to Settings → General and change both WordPress Address and Site Address from http:// to https://

Method 3: Database Search-Replace

Use the Better Search Replace plugin or WP-CLI to replace http://yourdomain.com with https://yourdomain.com across the entire database:

wp search-replace 'http://yourdomain.com' 'https://yourdomain.com' --all-tables

Warning: Always back up your database before running search-replace. An incorrect replacement can break your site.

Fixing Mixed Content on Non-WordPress Sites

1. Use Protocol-Relative URLs

<!-- Before --> <script src="http://cdn.example.com/library.js"></script> <!-- After --> <script src="//cdn.example.com/library.js"></script>

2. Content Security Policy: upgrade-insecure-requests

Add this header via .htaccess to make browsers automatically upgrade HTTP to HTTPS:

Header always set Content-Security-Policy "upgrade-insecure-requests"

Or in HTML head:

<meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests">

3. Fix URLs Directly in Source Code

grep -r "http://" /var/www/html/ --include="*.html" --include="*.php"

Preventing Future Mixed Content

Setting Up HSTS for Long-Term Mixed Content Prevention

HTTP Strict Transport Security (HSTS) is a response header that instructs browsers to always connect to your site using HTTPS. Once a browser receives the HSTS header, it will automatically upgrade all future HTTP requests to HTTPS for the duration of the max-age period — without waiting for a server-side redirect. This closes the window where a first-request HTTP connection could be intercepted.

Add HSTS to your .htaccess file:

Header always set Strict-Transport-Security "max-age=31536000; includeSubDomains; preload"

Understanding each directive:

Warning: Before adding HSTS, ensure every URL on your site works correctly over HTTPS. The HSTS header causes browsers to refuse HTTP connections for the entire max-age period. If your SSL certificate breaks afterward, visitors will be unable to access your site until the max-age expires.

Advanced Mixed Content Detection Methods

Beyond browser dev tools and basic online scanners, these methods give you broader coverage across multi-page websites:

Crawl with Screaming Frog or Sitebulb

Desktop crawler tools can spider every URL on your site and flag mixed content resources automatically. They export results as CSV so you can fix URLs in bulk — especially useful for large sites with hundreds of pages.

Check Google Search Console Security Issues

Google Search Console reports security issues, including mixed content detected by Googlebot during crawls. Navigate to Security & Manual Actions → Security Issues for a list of affected pages and resource URLs.

Server-Side grep via SSH

If you have SSH access, search your codebase directly for hardcoded HTTP URLs:

grep -rn "src=[\"']http://" /var/www/html/ --include="*.php" --include="*.html" --include="*.js" grep -rn "href=[\"']http://" /var/www/html/ --include="*.php" --include="*.html" --include="*.css"

Mixed Content, Core Web Vitals, and SEO Impact

Mixed content is not just a security issue — it directly affects Core Web Vitals and search rankings. When a browser blocks mixed active content, scripts that control interactivity fail silently, raising Interaction to Next Paint (INP) scores. Blocked stylesheets can also cause layout shifts, increasing Cumulative Layout Shift (CLS). Both are Google ranking signals.

Mixed Content Type Browser Behavior SEO Impact
Passive (images, video) Console warning, still loads Minor — padlock incomplete reduces trust signals
Active (scripts, CSS, iframes) Blocked entirely — features break Significant — hurts INP, CLS, and user experience signals
Mixed content in iframes Entire iframe blocked CLS increases if blocked iframe causes layout shift

Google's indexing pipeline also evaluates page trustworthiness as part of E-E-A-T (Experience, Expertise, Authoritativeness, Trustworthiness). A page displaying browser security warnings consistently signals low trustworthiness — which can suppress organic rankings over time even without a manual penalty.

AsiaGB Hosting includes free Let's Encrypt SSL on every plan, ready to activate from DirectAdmin. Once SSL is installed, use this guide to clean up any remaining mixed content from your pre-migration period.

Hosting with Free SSL on All Plans

Free Let's Encrypt SSL, easy setup, ready immediately. Starting at 500 THB/year with SSD storage and 99% Uptime.

View Hosting Plans

View all cheap Thailand web hosting plans →