Customer Support

  1. Support
  2. After the installation
  3. How to apply an SSL certificate and fix mixed content on my WordPress site?
  1. Home
  2. SSL
  3. How to apply an SSL certificate and fix mixed content on my WordPress site?
  1. Home
  2. Plesk
  3. SSL / Let's Encrypt
  4. How to apply an SSL certificate and fix mixed content on my WordPress site?

How to apply an SSL certificate and fix mixed content on my WordPress site?

1. Change your main WordPress URLs to HTTPS

You can change your WordPress main URLs to HTTPS in the following two ways.
We recommend the first one, as it is the easiest and the most secure. However, you may need to use the second one, in case the URLs are initially set in wp-config.php.

a. From the WordPress admin, select Settings >> General and change the two URLs from to

b. Alternatively, through the wp-config.php file we add the following lines.


2. Add redirect from HTTP to HTTPS

You can add the redirect in the following two ways.

In case you host your website in Plesk, we recommend the first one.

a. Through Plesk we select Hosting Settings.

Activate the option Permanent SEO-safe 301 redirect from HTTP to HTTPS and then select Apply and OK.

b. Alternatively, we add the following rules to the .htaccess file:

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R,L]

3. Replacement of mixed content

The replacement of mixed content can be done either through a plugin, such as Better Search Replace , either through the use of SSH and the use of the WP CLI.

With the following actions we basically replace all domain URLs that start with http to https.

In any case, we recommend that before starting the replacement, you make a backup of your database, so that you have a backup copy.
You could create a backup using Plesk's export 

a. Fixed mixed content using the plugin Better Search Replace

a1. Installation and activation of the plugin Better Search Replace from the WordPress admin by selecting Plugins from the Plugins admin >>New Plugin.

a2. Then select Tools >> Better Search Replace to display the plugin settings.

From the Search/Replace tab, perform the following actions.

In the Search for field, enter the http format:
In the Replace with field, enter the https format:
In the Select tables field, select all the tables by pressing Ctrl+a in the field.
Enable the Replace GUIDs field.
We disable the Run as dry run option so that it does not run in test mode.
Finally, click on Run Search/Replace to run the plugin.

b. Alternatively you can fix the mixed content using the WP CLI.

In case you have SSH access to your account and are familiar with using linux commands, you can run Search And Replace through the WP CLI.

b1. WP CLI is installed using the following commands.

curl -O
chmod +x wp-cli.phar
alias wp='~/wp-cli.phar'

b2. Replacing the URLs is done by running the following command. Where you will need to enter your domain.

wp search-replace ' ''

c. You can check the changes from the page below

Before proceeding with a check, you will first need to clear the cache memory from any caching plugin you may have installed. If the above tool no longer shows you mixed content, but you continue to receive a warning in your browser, you will need to clear your browser's cache as well.

In case you continue to have mixed content, it means that there are URLs that are either generated by a plugin or your theme that needs an upgrade or the URLs are written manually in the code and you should locate the relevant files and replace them.

Also, there is the possibility that the mixed content is generated by some links pointing to an external source and is in the database, and you will need to re-run the Search And Replace based on the domain of the external source.

If the external source does not support https, there is nothing you can do and you should either remove the relevant URLs completely, or leave them as they are with the relevant warnings.

You haven't found what you are looking for?

Contact our experts, they will be happy to help!

Contact us