I installed a certificate. The browser shows "Not secure" because images load over http, and with Cloudflare I also got ERR_TOO_MANY_REDIRECTS. What is the correct order of fixes?
DEV3 Developer Forum
How do I fix mixed content and redirect loops after moving WordPress to HTTPS?
Every post is reviewed first. Usually reviewed within 24 hours.
1 reply
Two separate problems: stored http URLs, and the server not knowing the request was HTTPS.
1. Update the site URL. Settings > General: both addresses to https://. If locked out, set them in wp-config.php temporarily (WP_HOME, WP_SITEURL) or run wp option update home 'https://example.com' and the same for siteurl.
2. Replace old URLs in the database, serialization safe:
wp search-replace 'http://example.com' 'https://example.com' --all-tables --dry-run
wp search-replace 'http://example.com' 'https://example.com' --all-tables
Page builder content and theme options are stored in the database, so this covers them. Also clear the builder's cache (for Elementor: Tools > Regenerate CSS and Data).
3. Redirect HTTP to HTTPS once, at the web server:
server {
listen 80;
server_name example.com www.example.com;
return 301 https://example.com$request_uri;
}
4. Redirect loops with a CDN or proxy. If Cloudflare is set to "Flexible" SSL, it talks HTTP to your origin while WordPress forces HTTPS, producing an infinite loop. Use "Full (strict)" with a valid origin certificate, and if the origin still sees HTTP add the X-Forwarded-Proto handling shown in the wp-config topic.
5. Find remaining mixed content in DevTools > Console. Typical sources: hard-coded http:// in theme files, third-party widgets, and old CSS url() references.
Pitfall: do not use a "force SSL" plugin plus a server redirect plus a theme redirect. Keep exactly one.