# How to Fix Mixed Content Errors

https://www.voligen.com/en/knowledgebase/article/fix-mixed-content

Your SSL certificate is installed and the site opens over HTTPS, yet the padlock still shows a warning. Almost always, something on the page is loaded over HTTP. This is called mixed content. This guide shows how to find the offending resources and fix them for good.

![One HTTP resource is enough to stop a whole page from looking secure.](https://www.voligen.com/templates/website/Voligen/assets/images/kb/mixed-content-hatasi.svg)

## What is mixed content?

If the page itself loads over HTTPS but one of its resources (an image, script, stylesheet or font) is requested from an `http://` address, the browser no longer treats the page as fully secure. There are two kinds:

- **Passive mixed content:** images, video and audio. Current browsers usually try to upgrade these to HTTPS automatically and skip them if that fails.
- **Active mixed content:** scripts (JavaScript), stylesheets and iframes. Browsers block these outright, so the page may look broken or some features may stop working.

## Before you start

- Your site needs a valid SSL certificate and an HTTP-to-HTTPS redirect. See "How to remove the Not secure warning".
- Back up first if you are going to make bulk changes to the database.

## Step 1: Find the offending resources

1. Open the affected page in Chrome, Edge or Firefox.
2. Press **F12** to open the developer tools and switch to the **Console** tab.
3. Reload the page. Warnings starting with "Mixed Content" show the full address of every resource requested over HTTP.
4. Note the addresses; often the same resource (a theme image or an old plugin) repeats across many pages.

![1: find the warnings in the console, 2: change HTTP links to HTTPS, 3: check the padlock.](https://www.voligen.com/templates/website/Voligen/assets/images/kb/mixed-content-hatasi-adim.svg)

## Step 2: Switch the links to HTTPS

### On WordPress

1. Under **Settings > General**, make sure **WordPress Address (URL)** and **Site Address (URL)** start with `https://`.
2. Replace the old addresses inside posts and pages in bulk. If WP-CLI is available on your server, this does the job:

```
wp search-replace 'http://example.com' 'https://example.com' --skip-columns=guid --dry-run
wp search-replace 'http://example.com' 'https://example.com' --skip-columns=guid
```

The first command (`--dry-run`) changes nothing and shows how many entries would be affected; if the result looks right, run the second. Without WP-CLI, a reputable "search and replace" plugin does the same.

1. If the problem remains, search your theme and plugin files for hard-coded `http://` addresses; update them or report them to the developer.
2. If you use a cache plugin such as LiteSpeed Cache, purge the cache when you are done.

### On other sites

Change resource addresses starting with `http://` to `https://` in your HTML, templates and CSS. For resources on your own domain, relative paths (`/images/logo.png`) are a good option too. If an external resource does not support HTTPS, host the file yourself or use an alternative.

### Stopgap: tell browsers to upgrade requests

Until every link is fixed, you can add this line to `.htaccess` so browsers automatically request HTTP resources over HTTPS:

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

> ****Note****
> 
> This header only rescues resources that support HTTPS. An external resource without HTTPS still fails to load; fixing the links is the permanent solution.

## Step 3: Check the result

Clear the cache and reopen the page in a private window. If no "Mixed Content" warnings remain in the console and the padlock is closed, you are done. Check other pages too, especially checkout and contact forms.

## Troubleshooting

| Symptom | Likely cause | Fix |
| --- | --- | --- |
| Warning on some pages only | Old image links in that page's content | Edit the post or run a bulk replace. |
| Fixed, but the warning persists | Page cache or CDN cache | Purge the plugin and CDN caches. |
| Menu or slider looks broken | Blocked active content (script or style) | Fix HTTP addresses in theme and plugin files. |
| An external widget does not load | The external service does not support HTTPS | Use the service's HTTPS embed code or switch provider. |

## Frequently asked questions

### Does mixed content put my site at risk?

A script loaded over HTTP can be altered in transit, so active mixed content is a real security risk. Passive content is less risky but still costs visitor trust.

### Can a plugin fix it in one click?

Some plugins rewrite addresses on every page load. It is a quick fix, but adds work on every visit. The permanent, faster fix is to correct the addresses in the database once.

### What should I watch out for with search-replace?

Back up first, run it in dry-run mode and leave the `guid` column alone.

If you cannot solve it, [contact us](https://www.voligen.com/iletisim) or open a support ticket from the client area. Looking for infrastructure tuned for WordPress? See our [WordPress hosting](https://www.voligen.com/wordpress-web-hosting) plans.
