A common issue immediately after installing an SSL certificate or forcing HTTPS is your website crashing with an ERR_TOO_MANY_REDIRECTS error. This means your website is stuck in a loop: it is trying to send visitors to the secure HTTPS version, but something is sending them back to HTTP, over and over again.

Why This Happens

This "redirect loop" usually happens because two different systems are fighting for control over your URL structure. Common causes include:

  • WordPress Settings Mismatch: Your WordPress dashboard is set to "http" but your server is forcing "https".

  • Conflicting .htaccess Rules: You have multiple lines of code in your server configuration file that contradict each other.

  • Cloudflare Settings: If you use Cloudflare, their SSL setting might be on "Flexible" while your server is already encrypted.

Solution 1: Update WordPress URLs

If you can still access your WordPress dashboard:

  1. Go to Settings > General.

  2. Look for "WordPress Address (URL)" and "Site Address (URL)".

  3. Ensure both start with https:// instead of http://.

  4. Save changes.

If you cannot access your dashboard because of the error, you can fix this in your wp-config.php file via cPanel File Manager:

  1. Edit wp-config.php.

  2. Add these lines just above "That's all, stop editing": define('WP_HOME','https://yourdomain.com'); define('WP_SITEURL','https://yourdomain.com');

Solution 2: Check Cloudflare Encryption

If your domain runs through Cloudflare, this is the most likely culprit.

  1. Log in to your Cloudflare dashboard.

  2. Click on the SSL/TLS tab.

  3. Check your encryption mode:

    • If it is set to Flexible, change it to Full or Full (Strict).

    • "Flexible" tells Cloudflare to talk to your server over HTTP, but if your server forces HTTPS, it creates a loop. Setting it to "Full" ensures both sides speak the same secure language.

Solution 3: Clean Up Your .htaccess File

Sometimes plugins add duplicate redirect rules.

  1. Open File Manager in cPanel.

  2. Find the .htaccess file in your public_html folder.

  3. Look for multiple "RewriteRule" blocks dealing with HTTPS.

  4. If you see conflicting rules, try renaming the file to .htaccess_backup to disable it temporarily. If the site loads (without the loop), you know the error is in that file's code.

Cette réponse était-elle pertinente? 0 Utilisateurs l'ont trouvée utile (0 Votes)