You have WordPress installed, SSL certificate is active on your web hosting, yet you still ask yourself the basic question – “Why isn’t HTTPS working on my WordPress?” The green padlock does not appear in the browser, instead, a padlock with a warning is displayed. The reason can sometimes be very simple. It’s called mixed content on the website.
Why isn’t HTTPS working on my WordPress?
To make HTTPS fully functional under all circumstances, the source code of the website must also be prepared for it. Simply put, all internal and external links used in the code must go through the https protocol. Let me give you an example.
The website will contain text, and a link to a contact form will be inserted into any part of it. This link is represented in the source code by a URL address that defines the page or place where the form is stored. If this URL contains https, everything is fine. However, if it does not, you get into a situation where you have mixed content on the website. That is, part of the source code is in https and part in http.
<a href=”https://blog.jirivanek.eu/contact-form/”>Contact form</a>”
<a href=”http(s)://blog.jirivanek.eu/kontaktni-formular/”>Kontaktní formulář</a>
How to fix mixed content in WordPress?
There are two options to fix this problem. One is easy, the other one is a bit harder. Let’s start with the easy one, as most WordPress users will end up using it. Yes, you guessed it right, it can be fixed with a plugin. The plugin is called Really Simple SSL and can be downloaded here. You install it in the usual way, through the plugin administration, where you find it, perform the installation and then the activation. The problem is solved.
The plugin does a very simple thing. It takes the output of the source code and, before sending it to the browser for display, it modifies all the links, replacing http with https. Therefore, there is no mixed content problem, and https is fully functional.
I recommend the second option to people who don’t want to use plugins for everything.
However, it is harder. How to do it?
- Log in to the MySQL database administration
- Create a backup here, i.e., export the database data to an SQL file
- Then open the SQL file in a better text editor, such as PSPad
- Use the “replace” function
- Replace http with https and apply the action to the entire document
- Import the modified SQL file into the previously emptied database
In the second case, you just make an export of your MySQL database data. In this export, you then manually replace all http parts with https. You delete the database content and replace it with the modified SQL file. This way, you effectively modify the source code of the website or the content of articles, pages, etc., where there will be no mixed content anymore.
The whole process is described step by step here, for the migration of WordPress from a subdomain to a domain. You will just replace a different part of the content, i.e., not the domain and subdomain but http with https.
Why isn’t HTTPS working on my WordPress? Conclusion
In both of the above cases, the problematic part of the code will be modified. Usually, this is in the content of pages or posts. Thanks to the modified output, the entire source code will contain correctly defined links, and the issue with the green padlock in the browser will be resolved.
More content about WordPress
Je mi líto, že pro Vás nebyl článek užitečný.
Jak mohu vylepšit článek?
Řekněte mi, jak jej mohu zlepšit.