Skip to content
Hire Me Login
URL CHANGE RESCUE

WordPress Login Not Working After URL Change? How to Get Back In Fast

You changed the WordPress Address or Site Address, clicked Save, and got kicked out. Now the login page loops, errors or won’t load at all. Don’t panic. Your site is fine. WordPress is just looking at the wrong address.

By Md Juwel Rana, WordPress Developer Β· Β· 10 min read

It’s one of the easiest ways to lock yourself out of WordPress. One wrong letter in Settings β†’ General, or switching to https before your SSL certificate is ready, and the dashboard disappears.

When the WordPress login not working after URL change problem hits, nothing has been deleted. WordPress stores your site address in the database and uses it for every redirect and every login cookie. Change it to something that doesn’t work, and WordPress keeps sending you there.

I’m Md Juwel Rana, a WordPress developer at Web Relife. I move and rebuild WordPress sites regularly, and this is the order I use to get back in. All you need is access to your hosting account.

Why Is My WordPress Login Not Working After URL Change?

Short answer: WordPress now thinks your site lives at the new address. If that address has a typo, doesn’t point to your server yet, has no SSL certificate, or doesn’t match where you’re actually logging in, the login cookie is set for one address and you’re sent to another. The fix is to set the right URL from outside the dashboard.

The usual suspects behind a WordPress login not working after URL change:

WordPress login not working after URL change: old site address replaced with a new one and the login cookie left behind
With WordPress login not working after URL change, the fix happens outside the dashboard.

What Kind of URL Change Did You Make?

Tap the one that matches. You’ll get the shortest path to fixing your WordPress login not working after URL change.

  1. Put the correct URL back with Fix 1 (wp-config.php) or Fix 2 (phpMyAdmin).
  2. Clear cookies (Fix 5) and log in.
  3. Fix the URL in Settings β†’ General, then remove the wp-config lines if you want the fields editable again.
  1. Make sure the new domain points to your server (DNS) before anything else.
  2. Set the new URL with Fix 1 or Fix 4 (RELOCATE).
  3. Update every old link with a proper search-replace: see this section.
  1. Check the SSL certificate is actually installed: Fix 6.
  2. If it isn’t, set the URL back to http:// with Fix 1 until it is.
  3. Remove duplicate https redirects from plugins, .htaccess or Cloudflare.

Locked out after changing your URL? I can fix it quickly.

Get Help Now

How to Fix WordPress Login Not Working After URL Change: 8 Fixes

Take a backup of your files and database from your hosting panel first. Then start with Fix 1. Most people with WordPress login not working after URL change are back in after the first two.

1

Set the URL in wp-config.php

Fastest Β· 3 minutes

Open File Manager in your hosting panel, edit wp-config.php in the site’s root folder, and add these lines above /* That's all, stop editing! */:

define( ‘WP_HOME’, ‘https://yourdomain.com’ ); define( ‘WP_SITEURL’, ‘https://yourdomain.com’ );

Use the address that actually works right now. If SSL isn’t ready, use http://. No trailing slash. These values override whatever’s saved in the database, which is exactly why this works when the dashboard doesn’t.

The catch: while these lines are there, the two fields in Settings β†’ General are greyed out. That’s normal. Remove the lines later if you want to edit them from the dashboard again.

2

Fix siteurl and home in phpMyAdmin

Permanent fix Β· 5 minutes

Open phpMyAdmin, choose your WordPress database, and open the wp_options table (your prefix may differ). The first rows are usually siteurl and home. Edit both option_value fields to the correct address. Or run:

UPDATE wp_options SET option_value = ‘https://yourdomain.com’ WHERE option_name IN (‘siteurl’, ‘home’);

Unlike Fix 1, this changes the saved value, so Settings β†’ General stays editable. For a lasting fix to WordPress login not working after URL change, this is the method I prefer.

3

Use functions.php (no database access)

If you only have FTP

The official WordPress guide describes this method too. Add these lines right after the opening <?php in your active theme’s functions.php:

update_option( ‘siteurl’, ‘https://yourdomain.com’ ); update_option( ‘home’, ‘https://yourdomain.com’ );

Load the login page a couple of times, log in, then remove both lines. Don’t leave them in the file.

4

Use the RELOCATE trick after a move

After a migration

If you moved hosts and now have WordPress login not working after URL change, WordPress has a built-in “relocate” mode for exactly that. Add this to wp-config.php above the “stop editing” line:

define( ‘RELOCATE’, true );

Then open https://yourdomain.com/wp-login.php on the new address and log in. WordPress updates the site URL to whatever address you used to reach the login screen. Check Settings β†’ General, save, then delete the RELOCATE line. WordPress’s own documentation warns that leaving it in can let an attacker change your site URL.

5

Clear cookies and cache

1 minute

Your browser may still hold login cookies for the old address. Clear cookies for both the old and new domain, or just use a private window. Also purge any cache plugin, server cache or Cloudflare cache. A cached login page can keep sending you to the old URL even after it’s fixed. This step alone clears up many WordPress login not working after URL change cases.

6

Make sure SSL works before using https

If you added https

A missing certificate is a big cause of WordPress login not working after URL change. Open https://yourdomain.com in a private window. If you see a privacy warning, the certificate isn’t installed or doesn’t cover that exact name (www and non-www both need covering). Install a free certificate from your hosting panel first. Until then, keep the URL on http://.

Once SSL works, have only one thing force https. If a plugin, .htaccess and Cloudflare all try to redirect at the same time, you’ll get “too many redirects.”

7

Check .htaccess for subfolder moves

If the path changed

If you moved WordPress into or out of a subfolder (for example from /blog to the root), the RewriteBase and final rule in .htaccess may still point to the old path. Back up the file and make sure it matches the new location. For a root install, it’s RewriteBase / and RewriteRule . /index.php [L].

8

Check your custom login URL

Security plugins

If a plugin changed your login address (to something like /my-login), /wp-login.php may show a 404 or redirect to the homepage. Use your custom login path on the new domain. If you’ve forgotten it, rename that plugin’s folder in wp-content/plugins to switch it off, log in normally, then set it up again.

Fix the Rest of the Old URLs (Without Breaking Anything)

Getting back in fixes the WordPress login not working after URL change problem, but your posts, images and settings may still point to the old domain. Don’t use a plain find-and-replace in phpMyAdmin. Some themes and widgets store data with character counts, and changing the length of a URL breaks them.

Use a tool that understands this:

Leave the GUID column alone. WordPress’s documentation is very clear about not changing the guid values in wp_posts. That’s why the command above skips them.
Symptom after URL changeLikely causeFix
Login page reloads, no errorCookie set for a different addressFix 1 or 2, then Fix 5
“Too many redirects”https forced without SSL, or several https redirectsFix 6
Browser privacy/SSL warningNo certificate for the new addressFix 6
Site not found / DNS errorNew domain not pointing to hostingFix DNS, then Fix 1
wp-login.php shows 404Custom login URL pluginFix 8
Logged in, but images are brokenOld URLs still in contentSearch-replace section

After-Fix Checklist

Tick these off once you’re back in. Your WordPress login not working after URL change issue is fully closed when they’re all done.

0 of 6 done

Moving domains or hosts soon? My WordPress migration service handles URLs, redirects and SSL so this doesn’t happen. And if your login problem started without any URL change, it might be something else: see WordPress admin redirects to homepage or hacked site, can’t log in.

Want Me to Fix It for You?

If your WordPress login not working after URL change problem won’t go away and you’d rather not touch wp-config.php or the database, send me your hosting access. I’ll get you back in and finish the move properly.

  • Restore login and correct the site address
  • Install or fix SSL and https redirects
  • Safely update every old URL in the database
  • Set up 301 redirects from the old domain
  • Update Google Search Console so rankings carry over

Frequently Asked Questions

Why can’t I log in after changing my WordPress URL?
WordPress now uses the new address for redirects and login cookies. If that address has a typo, no SSL, a www mismatch or doesn’t point to your server, you get sent somewhere that doesn’t work. Set the correct URL in wp-config.php or phpMyAdmin.
How do I change the WordPress URL back without the dashboard?
Add WP_HOME and WP_SITEURL to wp-config.php, edit siteurl and home in the wp_options table with phpMyAdmin, or temporarily add update_option lines to your theme’s functions.php.
What does define(‘RELOCATE’, true) do?
It tells WordPress to set the site URL to the address you used to reach wp-login.php. Log in, check Settings β†’ General, then remove the line, because leaving it in is a security risk.
Why do I get “too many redirects” after switching to https?
Either the SSL certificate isn’t working, or more than one thing is forcing https (a plugin, .htaccess and Cloudflare at the same time). Fix the certificate and keep only one https redirect.
Can I just search and replace the old URL in phpMyAdmin?
It’s risky. Some data is serialized and breaks when string lengths change. Use WP-CLI search-replace or Better Search Replace, and skip the guid column.
Will changing the URL hurt my Google rankings?
Not if you do it properly. Set up 301 redirects from the old URLs, update internal links, and add the new address in Google Search Console.
JR
Md Juwel Rana is a full stack WordPress developer at Web Relife. He’s spent over 10 years fixing hacked and broken WordPress sites, migrations, email problems and WooCommerce stores. Need a hand? Hire me here.