keepcalculator

06 Numbers and Powers

Can’t Access WordPress Admin After Enabling HTTPS? Fix

Card No. 06·40609 · Updated · Standard formula, shown below

If you enabled HTTPS and now get a redirect loop, a “too many redirects” error, or a blank login screen, the cause is almost always a mismatch between your WordPress site URL settings and how your server or caching layer handles HTTPS. The fix is to update the wp_options table (or wp-config.php) to use https:// in both the site URL and home URL, then clear any caching and check for mixed-content or redirect loops. Below is a complete, step-by-step guide to regain access to your WordPress admin after enabling SSL.

Why HTTPS Breaks WordPress Admin Access

WordPress stores its full site address in two database options: siteurl (the core WordPress installation) and home (the address visitors use). When you switch to HTTPS, your server may redirect HTTP to HTTPS, but if these options still say http://, WordPress will generate admin links and redirects with the old scheme, causing a loop. Additionally, your web server (Apache, Nginx, LiteSpeed) may have a redirect rule that conflicts with WordPress’s own .htaccess rules, or a caching plugin may serve a cached version of the login page that still references HTTP.

Quick Fix: Update Site URL via Database or wp-config.php

If you cannot log in at all, you have two reliable methods to change the URL settings without the dashboard. Choose one based on your hosting access.

Method 1: Edit wp-config.php (No Database Needed)

  1. Connect to your site via FTP or your hosting file manager.
  2. Open wp-config.php in a plain text editor.
  3. Add these two lines just before the line that says /* That's all, stop editing! Happy publishing. */:
define('WP_HOME', 'https://yourdomain.com');
define('WP_SITEURL', 'https://yourdomain.com');

Replace yourdomain.com with your actual domain. Save the file and try accessing https://yourdomain.com/wp-admin/. This overrides the database values.

Method 2: Update via phpMyAdmin

  1. Log into your hosting control panel and open phpMyAdmin (or your database management tool).
  2. Select your WordPress database.
  3. Click the wp_options table (the prefix may be different, e.g., myblog_options).
  4. Find the rows where option_name is siteurl and home.
  5. Double-click the option_value for each and change http:// to https://. Save.

After updating, try logging in again. If you still get a loop, clear your browser cache and any server-side cache (like Varnish or Cloudflare).

Force HTTPS in .htaccess (Apache)

If your server isn’t already redirecting HTTP to HTTPS, you can add a redirect rule. But be careful: if you add it before fixing the URL settings, you may reinforce the loop. Add this to your .htaccess file (usually in the root folder) above the WordPress rewrite block:

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

If you’re on Nginx, you’d add a similar return 301 https://$host$request_uri; in the server block. This forces all traffic to HTTPS, which is fine once your WordPress URLs are already updated.

Clear All Caches (Browser, Plugin, Server)

Often the redirect loop persists because a cached copy of the login page or redirect rules is being served. After updating your URLs, clear:

  • Browser cache – clear cookies and cached files, or try an incognito/private window.
  • Caching plugin – if you have WP Rocket, W3 Total Cache, or similar, delete all cache files from the plugin’s settings (you may need to access the files via FTP if the plugin is causing the loop).
  • Server cache – if your hosting uses Varnish, Memcached, or a CDN like Cloudflare, purge the cache from their dashboards.

Fix Mixed Content and Login Redirect Issues

Once you’re back in the admin, you may see a warning about mixed content (HTTP resources on HTTPS pages). This doesn’t block login but can cause issues with the dashboard. Use a plugin like “Really Simple SSL” to automatically replace HTTP references with HTTPS. Alternatively, you can run a database search-replace for http://yourdomain.com to https://yourdomain.com using a tool like WP-CLI or a search-replace plugin. Be careful not to replace https:// inside other URLs (like external links) – you should only replace the exact domain string.

Common Problems and Their Specific Fixes

  • Redirect loop after login: Usually the siteurl/home mismatch. Recheck those values.
  • Login page loads but login button does nothing: Could be a caching plugin serving a stale page. Disable the plugin by renaming its folder via FTP (e.g., wp-content/plugins/wp-rocket to wp-rocket-disabled).
  • SSL certificate not installed correctly: Check that your certificate covers the domain (including www vs non-www). Use an online SSL checker to verify.
  • WordPress address (URL) is different from Site address (URL): If they differ, you may need to set both to the same HTTPS URL. For most sites, they should be identical.
  • After moving from HTTP to HTTPS, images or CSS are broken: This is mixed content. Use a plugin to fix URLs or manually update the database.

Prevention: Best Practices for Future HTTPS Changes

To avoid this issue in the future, always update the site URL and home URL in the WordPress admin (Settings > General) before forcing HTTPS redirects. If you’re using a security plugin that forces HTTPS, make sure it’s configured after the URL change. Also, keep a backup of your database and files before making any changes. Many hosting providers offer one-click SSL installation and may automatically update the WordPress URLs – if so, use that feature first.

Frequently Asked Questions

Why do I get “ERR_TOO_MANY_REDIRECTS” after enabling HTTPS?

This usually happens because your site URL is still set to HTTP, so WordPress tries to redirect to the HTTP version, while your server is redirecting HTTP to HTTPS, creating a loop. Update the site URL and home URL to HTTPS as described above.

Can I fix this without phpMyAdmin or FTP?

If you have access to the WordPress admin on a different URL (e.g., via a staging site), you can change the settings there. Otherwise, you may need to contact your hosting provider for support – they can often update the database for you.

Will changing the site URL in the database break my site?

No, as long as you change both siteurl and home to the correct HTTPS URL. If you change only one, you may cause other issues. Always back up the database first.

What if my SSL certificate is only for www, not non-www?

If your certificate doesn’t cover both, you’ll get a security warning. You should install a certificate that covers both (most modern certificates do). Then set your WordPress URL to the version that matches your certificate (e.g., https://www.yourdomain.com).

Do I need to force HTTPS in .htaccess after fixing the URL?

It’s a good practice to force HTTPS for security, but only after the WordPress URLs are updated. If you force it before, you may get the loop again. Add the redirect rule after confirming the admin works.

My login page loads but the styles are broken – is that an HTTPS issue?

Yes, that’s mixed content. Your browser blocks insecure resources (HTTP) on HTTPS pages. Use a plugin to replace HTTP URLs with HTTPS in your database, or manually update the affected URLs.

Related

Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.

More cards in this drawer

The whole Numbers and Powers drawer →