Bitnami WordPress站点更换SSL证书后出现Too many redirects问题求助
Hey there, let's break down this too-many-redirects issue you're hitting after updating your SSL certificates on Bitnami WordPress. Based on the details you shared, here are the most likely causes and actionable fixes to try out:
1. Check for conflicts between WordPress URL settings and redirect rules
First things first—when Cloudflare is set to "Off", your site is being accessed directly without Cloudflare's proxy. If your WordPress core settings are still pointing to HTTPS but your server's HTTPS configuration has issues, this creates a loop.
- Log into your WordPress admin (you can do this while Cloudflare is in "Full" mode since the site loads there)
- Head to Settings > General and confirm both WordPress Address (URL) and Site Address (URL) are set to the exact same HTTPS URL (e.g.,
https://yourdomain.comorhttps://www.yourdomain.com—stick to one format consistently)
2. Verify your port 80 redirect configuration
You mentioned adding redirect rules under port 80—make sure they're clean and not conflicting with any default Bitnami rules. Bitnami often includes pre-built redirect logic, so adding duplicate rules can trigger loops.
A proper port 80 config should look like this (adjust for your domain):
<VirtualHost *:80> ServerName yourdomain.com ServerAlias www.yourdomain.com # Simple permanent redirect to HTTPS Redirect permanent / https://yourdomain.com/ </VirtualHost>
Also, check your WordPress .htaccess file (in /opt/bitnami/apps/wordpress/htdocs/) for any extra redirect rules—comment them out temporarily to test if they're causing the loop.
3. Validate your port 443 SSL configuration
Since the site works with Cloudflare "Full" mode, the issue might be that your server's direct HTTPS (port 443) isn't properly configured when Cloudflare is off.
- Double-check that your new SSL certificate files are correctly referenced in the port 443 config:
<VirtualHost *:443> ServerName yourdomain.com ServerAlias www.yourdomain.com SSLEngine on SSLCertificateFile "/opt/bitnami/apache2/conf/ssl.crt/your-new-cert.crt" SSLCertificateKeyFile "/opt/bitnami/apache2/conf/ssl.key/your-new-key.key" SSLCertificateChainFile "/opt/bitnami/apache2/conf/ssl.crt/your-chain-file.crt" # Include this if your CA provided a chain # Rest of your WordPress-specific config </VirtualHost>
- Ensure the certificate files have the right permissions (Bitnami typically requires
root:rootownership and600file permissions for key files) - Test accessing your server's direct HTTPS URL (e.g.,
https://your-server-ip) when Cloudflare is off—if you get a certificate error, that's the root cause: your browser rejects the invalid cert, bounces back to HTTP, and the port 80 redirect sends it back to HTTPS, creating the loop.
4. Check wp-config.php for forced SSL settings
Bitnami WordPress sometimes has forced SSL settings enabled in wp-config.php that can cause loops if direct HTTPS isn't working.
Open /opt/bitnami/apps/wordpress/htdocs/wp-config.php and look for these lines:
define('FORCE_SSL_ADMIN', true); define('FORCE_SSL_LOGIN', true);
If they're present, comment them out temporarily (add // at the start of each line) and test with Cloudflare off. If the loop stops, you'll know the issue is with your server's direct HTTPS configuration—fix that first before re-enabling these settings.
5. Ensure consistent ServerName/ServerAlias across both ports
You mentioned adding ServerName and ServerAlias to both ports—double-check that they're identical on port 80 and 443. A mismatch (e.g., port 80 uses yourdomain.com while port 443 uses www.yourdomain.com) will trigger redirect loops as the server bounces between the two formats.
备注:内容来源于stack exchange,提问作者Dhaval Joshi

