What is a Mixed Content Error in Short?
DISCLOSURE: When you buy through links on my site, I may earn an affiliate commission. This keeps it 100% reader-supported and free of ads or sponsorships. Thank you for your support!
Last Updated on 24th April 2022 by Ajmer Singh
What is a mixed content error?
Mixed content is a term used by web browsers to describe pages viewed over HTTPS that include insecure assets, such as images or scripts loaded from HTTP locations.
How to change http to https in WordPress website?
If your website uses HTTPS then it will have an SSL certificate which basically secures the connection between users’ browser and your server.
The problem is that not all web servers are properly configured for hosting websites with SSL certificates, so sometimes people see this kind of error message in their browser:
That’s why I recommend selecting a fully performance-based hosting.
Mixed Content Example:
The page at ‘https://domain.com/page-1’ was loaded over HTTPS, but requested an insecure script ‘http://domain2.com/script2.js’.
This request has been blocked; the content must be served over HTTPS.
Mixed content example in Google Chrome
In case you see this warning in your browser – it means that the page is trying to load javascript code over an http (insecure) connection.
First, let’s understand what causes mixed content:
Some web servers do not support hosting multiple websites with SSL certificates and also scripts and images from external sources or other websites.
Secure way to serve shared files: /home/site1/subdir1/script2.js –> https://domain.com/subdir1/script2.js
Unsecure way to serve shared files: /home/site2_subdir4_sharedimage3.png –> http://third-partydomain-or-IP/sharedimage3.png
As you can see – the first way is clean and secure, while the second one includes all kinds of variables that may create security flaws on your site.
In case you have a WordPress website then there are two possible solutions for mixed content:
1) You manage your web hosting account and configure it to support secure websites.
In this case, contact your hosting provider and ask them to enable an SSL certificate on your web server.
Also, they should ensure that scripts from external sources will be requested over https:// connection as well.
2) If you do not have control of the hardware or hosting plan used by your web host,
then you have to use some other way how to fix mixed content errors in WordPress.
For example, by using some plugin that forces all your content to be served by https://
Really simple SSL or WP Force SSL is one of such plugins and it will redirect all http requests over SSL as well as force scripts and styles to use https connections – basically mitigating mixed content error in WordPress.
We can conclude that the main reason for mixed content is insecure servers that cannot host websites properly.
So do not forget about contacting your hosting provider and asking them to fix the issue.
We hope you find this article useful and don’t forget to share! Thank You!