How to Fix Mixed Content Error in Wordpress with .htaccess

Home \ WordPress \ How to Fix Mixed Content Error in WordPress with .htaccess
fix_mixed_content_error_in_wordpress

How to Fix the Mixed Content Error in WordPress with .htaccess

Are you seeing the mixed content error in WordPress? Mixed content error in WordPress is caused by incorrect HTTPs/SSL settings.  It doesn’t affect your website’s functionality, but it can affect your website’s SEO and user experience. In this article, we will show you how to fix the mixed content error in WordPress without any pluging.

What is Mixed Content Error in WordPress?

It is highly recommended to add SSL certificate in WordPress blog or website because after July 2018 Google Chrome will mark all http versions of website as insecure.

SSL adds an additional security layer around data transferred from your website to users’ browsers. Search engines like Google recommend using SSL on your website as well.

All best WordPress hosting provider companies are now offering free SSL within their hosting packages. If your hosting company doesn’t offer that, then you can get free SSL through Let’s Encrypt or Cloudflare for your WordPress site.

If you have correctly implemented SSL on your website, then you will see a green lock icon before your website’s URL in the browser address bar.

secure_url

 

While incorrect SSL setup doesn’t shows green lock.

fix_mixed_content_error_in_wordpress

This shows that while your website is using a SSL certificate, but some content on your website is still served from non HTTPS urls.

Fixing Mixed Content Error in WordPress

There is no need of any plugin to fix this mixed content error. Just add the following code in your .htaccess file.

RewriteOptions inherit
RewriteEngine on

Header set content-Security-Policy: upgrade-insecure-requests

Note: Be sure .htaccess re-write must be enabled on your hosting server. if it is disabled by your host provider you cannot save the above code in your .htaccess file.

Where to Find .htaccess file

.htaccess is most important file of your site. It contains all sensitive information about your site.

If you are using cPanel then login into it. Then goto Files => File Manager => public_html

In public_html folder your site .htaccess file is located. If you don’t see .htaccess file in in public_html folder then there is a Settings button on top right position. Click the Settings button. A popup will open. Tick the “Show Hidden Files (dotfiles)” option.  Click Save

Now your .htaccess file will appear.

Select .htaccess file, click Edit and paste the above given code in it. Hit Save button.

If you are using Yoast SEO plugin then you also can do it with this.

Login to your wordpress admin panel => SEO => Tool => File Editor => .htaccess file

You can edit your .htaccess file content here. Paste the given code here and save the file.

Important Note:

Now most important thing. Don’t forgot to clear the cache of your both wordpress site and you  pc browser.

After doing all steps, you will see all insecure pages are upgraded to secure one with a green lock.

 

If this article works for you then post your comments below.


Images Credits: Kinsta and WpBeginner

 

If you found this article helpful. Share it with others. Also Subscribe to our Newsletter and follow & Like Us on Twitter & Facebook and find perfect Web Hosting for your site with discount and deals.

ABOUT THE AUTHOR: Editorial Staff

RELATED POSTS

LEAVE YOUR COMMENT

Your email address will not be published. Required fields are marked *