Posted on Leave a comment

Fixing Common SSL Issues in WordPress

Several errors can occur when trying to add SSL with your WordPress website. In this article, you will learn how you can fix these errors.

NET:ERR_CERT_INVALID Error

If you get this error, it means the SSL certificate may be expired or issued to a different domain or subdomain. Also, the browser may be facing issues trying to recognize its authority. To fix this error, you can reinstall the SSL certificate.

Mixed Content Errors

Mixed Content Errors are caused by the elements, like scripts or images, not being loaded via secured HTTP protocol. You can fix this in two ways; first is by using a plugin. The second way is by fixing the issue manually.

Fix Using a Plugin

Get the Really Simple SSL plugin from the WordPress repository. After installation and activation, go to Settings > SSL to review plugin settings. The plugin will automatically fix the errors.

Fix it Manually

First, make sure you are using the HTTPS protocol in your WordPress website settings. Go to the general settings of your website to change HTTP to HTTPS.

Once this is done, go through your website manually to check old HTTP URLs in your database and replace with the new HTTPS URLs. An easy and fast way of doing this is by installing the Better Search Replace plugin. Activate the plugin, go to Settings > Tools > Better Search Replace. Then, add the current HTTP website URL in the Search field. Afterwards, add the website URL with HTTPS in the Replace field.

Fixing the Too Many Redirects Errors

To fix this error, access the wp-config.php file and put the following code.

define(‘FORCE_SSL_ADMIN’, true);

However, in some cases, this setting can actually lead to many more redirect errors. In such case, add the following code to your wp-config.php file:

define(‘FORCE_SSL_ADMIN’, true);
//in some setups HTTP_X_FORWARDED_PROTO might contain
//a comma-separated list e.g. http,https
//so check for https existence
if (strpos($_SERVER[‘HTTP_X_FORWARDED_PROTO’], ‘https’) !== false)
$_SERVER[‘HTTPS’]=’on’;

Fix HTTP to HTTPS Redirect

You can fix this error can accessing your .htaccess file and adding the code to it.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
</IfModule>

Conclusion

Try the solutions discussed above and you see your WordPress website up and running, again.