How To Resolve Mixed Content Warning

You all might have received an update from WordPress that they will only promote hosting partners that provide an SSL certificate by default in their accounts. So, the whole world is moving their websites from HTTP to HTTPS.

Enabling an SSL makes all Non-secure HTTP requests to HTTPS. It’s not an easy task to edit all the links from all your articles. And most of the beginners face mixed content warning over the internet browser.

In the previous article, I have shared an easy guide to setup free universal SSL on a website or a blog. Hope you have already gone through it. After adding SSL to the existing blog or a website you might mop up Mixed Content Warnings.

So, in this guide post, I am sharing some easy tips to fix the mixed content warning. It will not take more than 5-10 mins to fix it.

Before we start fixing mixed content warnings, let’s understand basic of the Mixed contents.

What is Mixed Content?

Mixed content occurs when initial HTML is loaded over a secure HTTPS connection. But some other resources such as images, videos, stylesheets, scripts being loaded over an insecure HTTP connection.

In short, the Mixed content warning occurs because of both HTTP and HTTPS content are being loaded to display the same page.

Fixing Mixed Content Warning

If I guess, you might be using CloudFlare to manage your DNS. Right??

Install the official CloudFlare WordPress plugin & activate it. Then Go to Settings > CloudFlare & configure the plugin. This plugin will auto fix the too many redirection loops.

You can also add page rule to redirect all website resources to the HTTPS. To do so all you need to add a page rule for the URL http://*yourdomain.com/*. Here we added ‘*’ at the beginning and the end as the beginning * tells to redirect all the subdomain directories and last * tell to redirect URL pattern.

Fixing Mixed content warning using page rule
Adding page rule to the CloudFlare

Then choose Always use HTTPS in the settings. Make sure this rule should be at the top of all other rules. So choose First in the order then Save and Deploy. Go to cache settings and purge all the cache. That’s it now your site URL are forcefully redirected to the HTTPS.

CloudFlare also provides a single button option for Automatic HTTPS Rewrites. It helps fix mixed content by changing “http” to “https” for all resources or links on your website that can be served with HTTPS.

HTTPS for WordPress Admin Panel

Now, you need to configure all these with complete migration. Means you are going to use HTTPS for your WordPress Admin Panel.

  • To do this edit the WordPress “wp-config.php” file.
  • For editing, Login to your Hosting using FTP.
  • open the file & add command: define(‘FORCE_SSL_ADMIN’, true);. into code as shown in Image:

Editing wp-config.php File

Change Website Address To HTTPS:

From the WordPress dashboard, go to Settings > General and change the WordPress Address & Site Address to HTTPS. shown in the image.

Fixing Mixed Content warning
Changing WordPress and Site Address

Adding Redirect using htaccess

Non-CloudFlare users can add redirect using htaccess file.  Just add the following code to the htaccess file on your server.

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

Editing htaccess file can break your site, so I recommend you to check our tutorial 3 Correct Ways to Edit .htaccess File.

Bonus Tips

  • Add the “https” site in the Google Search Console & Bing Webmaster Tool.
  • Submit your sitemap.
  • Update all of your social profile links to point to the “https” site.
  • Use the Broken Link Checker plugin to find redirected internal links & fix them with one click.
  • Go to Google Analytics & update the site’s URL.

Hope you find this article helpful, please help us to grow by sharing our contents with your friends on your social networks.

ALSO READ

Subscribe to our newsletter

To be updated with all the latest news, offers and special announcements.

Comment Policy: Your words are your own, so be nice and helpful if you can. Please, only use your real name and limit the amount of links submitted in your comment. We accept clean XHTML in comments, but don't overdo it please.

1 COMMENT

  1. Hey Amit,
    Great write up, especially about using Cloudflare to automatically handle rewrites.
    For anyone not using Cloudflare, or just looking to clean up their site before Cloudflare even gets to it, we have a couple tools to help track down mixed content.
    Hope it's of use.

LEAVE A REPLY

Please enter your comment!
Please enter your name here

GET STARTED

Start WordPress Blog: Ultimate Guide For Beginners

Here is our step by step guide for beginners to start a WordPress blog.

Top 6 Best WordPress Theme Frameworks

There are many websites themes which are created by using a framework. Likewise, WordPress Theme frameworks also becoming so popular. The framework allows you...

The Most Essential WordPress Plugins

Here, I have listed some excellent plugins which will surely add more features and new functionality to your WordPress blog.

Tips to Speed Up WordPress Performance

Here, I am sharing some tips to speed up WordPress performance. All you need to modify .htaccess file on your server and add some plugins.

The Ultimate Guide to Harden WordPress Security

Learn how to improve WordPress security. Here are some basic security concepts that will help you to harden WordPress security.

How to Setup CloudFlare Free SSL for WordPress Blog

Google has announced that they will count HTTPS as a ranking factor which means if you using HTTPS you will get a higher position...

DEALS

SEMrush

TRY SEMrush for Free!

POPULAR NOW

Get almost 100% PageSpeed on Newspaper theme

The newspaper theme is the most popular premium theme for a self-hosted WordPress blog. The theme is developed by team tagDiv. You...

How to Remove jQuery Migrate in WordPress?

jQuery Migrate greatly simplifies the process of moving older jQuery code to a higher jQuery version by identifying deprecated features. It then restores deprecated...

How To Reduce Admin-Ajax Server Load In WordPress

To increase better user experience, we always end up by increasing site speed. After clicking a website link seems like a simple thing. But...

Best Guide on Removing v=XXXX string from WordPress URLs

You might have noticed strange v=xxxx string in your WordPress URL. This string is comprised of an apparently arbitrary letter and numbers added as a parameter...

Tips to Speed Up WordPress Performance

Here, I am sharing some tips to speed up WordPress performance. All you need to modify .htaccess file on your server and add some plugins.

How to Display Featured Image Before or After Entry Title in Genesis

Learn how to add featured image to a single post or a page in Genesis child themes. You can set it to display featured...