Black Friday hosting deals · every offer with its renewal price

// wordpress & cpanel how-tos

Can't access WordPress admin after changing the URL? Here's the fix

You edited the WordPress Address or Site Address in Settings → General, added or removed "www", and now you can't log in. It's a common mistake, and you can fix it in one minute.

Why it happens

You're not the only one who makes this mistake. Many new bloggers change settings without being sure what they do. When you add or remove "www" (or switch between http and https) in the site address, WordPress treats it as a different domain, and the login redirects stop working, so you can't reach your dashboard.

Next time, search or ask before changing a setting you're not sure about. It will save you time and problems.

The fix: set the URL in wp-config.php

  1. Log in to cPanel and open File Manager.
  2. Find wp-config.php in your WordPress folder (usually public_html), select it and click Edit.
  3. Add these two lines above the "That's all, stop editing!" line, with your own domain:
define( 'WP_HOME', 'https://www.yourdomain.com' );
define( 'WP_SITEURL', 'https://www.yourdomain.com' );

Use exactly the address your site should have, with or without "www", and https if you have SSL. Save the file, clear your browser cache and reload the page. You'll be able to log in again.

You'll notice the address fields in Settings → General are now greyed out. That's normal, because the address is set in wp-config.php, which is simpler and safer. To change it later, edit those two lines.

Keep a second way into your site

Always make a backup before you change your blog settings, especially if you're new to WordPress. Specific errors aren't always easy to solve online. The WordPress.org forums are a great place to ask, but the people there are volunteers, so you may wait a long time for a reply.

If you care about your website, make sure you can reach your files through FTP with a client like FileZilla, and through File Manager in your hosting account. If one method doesn't work, you still have another way to fix things.

FAQ

How do I fix the WordPress URL without access to the dashboard?

Edit wp-config.php through File Manager or FTP and add WP_HOME and WP_SITEURL lines with your correct site address. WordPress then uses those values instead of the ones saved in the database, and you can log in again.

Why are the WordPress Address fields greyed out?

Because WP_HOME and WP_SITEURL are defined in wp-config.php. WordPress uses those values and locks the fields in Settings → General. Remove or edit the two lines in wp-config.php if you want to manage the address from the dashboard again.

Keep reading

WRITTEN BY

Fathi Arfaoui

Fathi Arfaoui has helped people choose web hosting, start blogs and build WordPress sites since 2013. He founded SiteHostingFinder to replace opinion-based hosting reviews with real prices and public data. He has been a HostGator customer since 2013 and has hosted 40-50 WordPress sites on Pressable since 2017.