Can an expired certificate cause redirect loop?

I am adding ssl on a site which had Lets encpyt ssl certificate earlier and now it expired. When I enable flexible mode for it, it causes a redirect loop.

Can expired certificates can also cause redirect loop? Also is there any way to trace the path of redirect loops easily? Something like a tool probably or with console?

Nope. Instead, it throws SSL error that cert is expired.

Here’s the fix …

  1. Edit wp-config.php file
  2. Add below code above define( 'WP_DEBUG', true );
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)

Learn more

1 Like

Thanks for reply sir. It is not a wordpress site though

You’re welcome!

Alternatively, you can put below code if .htaccess is supported.

RewriteEngine On
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]
1 Like