Why the padlock is missing from the address bar, and how to fix it.
Contents
Mixed content happens when an HTTPS page loads resources (images, scripts, stylesheets) over the unsecured HTTP protocol. This creates security problems and can trigger browser warnings.
What mixed content is
There are two types of mixed content:
- Active mixed content — scripts, stylesheets and iframes that can change the page
- Passive mixed content — images, audio and video
Modern browsers block active mixed content and warn about passive mixed content.
Signs of the problem
- Warnings in the browser console about insecure content
- A padlock in the address bar that isn’t closed
- Parts of the page not displaying correctly
- Messages such as “Mixed Content Warning”
Diagnosing the problem
Step 1: Check in the browser
- Open your site in a browser (Chrome or Firefox)
- Press F12 to open the developer tools
- Go to the Console tab
- Look for mixed content warnings
Step 2: Online tools
Use a specialist service:
Fixing it through cPanel
Method 1: Using .htaccess
- Log in to cPanel
- Open File Manager
- Go to your site’s root directory (usually public_html)
- Find the .htaccess file (create it if it doesn’t exist)
- Add the following code at the top of the file:
# Force a redirect to HTTPS
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# Content-Security-Policy header to upgrade insecure content
<IfModule mod_headers.c>
Header always set Content-Security-Policy "upgrade-insecure-requests"
</IfModule>Method 2: SSL/TLS settings in cPanel
- Log in to cPanel
- Find the Security section
- Open SSL/TLS Status
- Click Run AutoSSL to install a certificate automatically
- Make sure all your domains have an active SSL certificate
Method 3: Fixing the database (for WordPress)
If you use WordPress:
- Open phpMyAdmin in cPanel
- Select your site’s database
- Run an SQL query to replace the URLs:
UPDATE wp_options
SET option_value = REPLACE(option_value, 'http://yoursite.com', 'https://yoursite.com')
WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts
SET post_content = REPLACE(post_content, 'http://yoursite.com', 'https://yoursite.com');
UPDATE wp_postmeta
SET meta_value = REPLACE(meta_value, 'http://yoursite.com', 'https://yoursite.com');Warning Replace yoursite.com with your real domain. Back up the database before running the queries.
Method 4: Editing theme files
- In File Manager, go to the theme directory
- Find files with hard-coded HTTP links
- Replace every http:// with https://, or use relative paths
- Save your changes
Checking after the fix
- Clear your browser cache (Ctrl+F5)
- Clear your site’s cache (if you use one)
- Check the browser console for errors
- Make sure the padlock in the address bar is closed
Further recommendations
- Use relative URLs — instead of
http://example.com/image.jpg, use/image.jpg - Protocol-relative URLs — use
//example.com/style.cssinstead ofhttp:// - Check regularly — scan your site for mixed content from time to time
- CDNs and external resources — make sure all external libraries are loaded over HTTPS
Troubleshooting
Problem: .htaccess isn’t working
Solution:
- Check that mod_rewrite is enabled
- Make sure AllowOverride is enabled in the Apache configuration
- Check the syntax of the .htaccess file
Problem: no SSL certificate is installed
Solution:
- In cPanel, open SSL/TLS
- Use Let's Encrypt (free SSL)
- Or install a certificate manually through Manage SSL sites
Problem: mixed content from external sources
Solution:
- Upload the resources to your own server
- Use the HTTPS versions of external resources
- Use the Content-Security-Policy header
Useful links
See also
- SSL certificates
- Website security
- HTTPS configuration
- cPanel guides
Didn’t find the answer? Ask our support team — we’ll help.