One of the common WordPress errors is having a problem accessing WordPress after changing the site URL on the WordPress general settings page.
The first thing you need to know is that you’re not the first or the only one to have this issue, almost all beginners will have this issue too.
In this guide, I will show you how you can fix the problem and how to change your WordPress site URL in order to be able to access your WordPress Admin again.
The reason why you cannot change the website URL again is that the page where you can change the URL again is not in the right location. As you changed the site URL, all website URLs have been updated to the new one including the URL of the General settings page where you can change the URL.
But the actual location of WordPress files is still in the old location, so when you try to visit WordPress admin URL you actually requesting a page that does not exist.
To solve the “Can’t access WordPress after changing site URL” error you simply need to change the website URL and restore the old URL.
How to Manually Change WordPress Site URL
To change the WordPress site URL you need to do it manually as you can’t do it from your WordPress admin panel. That is possible via 4 methods, the easiest two of them are:
- Changing The WordPress site URL by editing the
- Changing the WordPress URL via phpMyAdmin.
Fix #1: Changing the WordPress Site URL by Editing the wp-config.php file
This fix solves the problem by adding two lines of code to the WordPress configuration file ‘wp-onfig.php’.
To do so you will need to have access to your WordPress hosting panel or FTP access in order to be able to edit your
After adding the code and saving the changes to the file you will regain access to your WordPress site and you will be able to log in to the admin area as usual.
However, this method is not the best practice.
What it does is hard-coding the site URL into the code of WordPress itself. Thus, it will not be possible to change the WordPress site URL on the WP admin panel’s General settings page anymore if you are using this method.
Login to your WordPress hosting cPanel.
Under the Files section, click on File Manager.
Open File Manager and search for a file called
wp-config.php and click on “Edit file”.
Add the following two lines of code to the top of the
wp-config.php file after replacing
https://www.example.com with your site URL, then save the file.
define('WP_SITEURL', 'https://www.example.com'); define('WP_HOME', 'https://www.example.com');
That’s all, try accessing your WordPress Admin panel now.
If you don’t have cPanel, you can use FTP to edit the wp-config.php file. Or you can follow the second fix to change the WordPress URL via phpMyAdmin.
Fix #2: Changing WordPress site URL via phpMyAdmin
The second method to change the WordPress URL and fix the “Can’t access WordPress after changing site URL” problem is to manually change the site URL value in the WordPress database.
This can be easily done using phpMyAdmin which most WordPress hosting providers offer for free and comes bundled with cPanel.
If your host doesn’t have phpMyAdmin you can use their alternative online database administration tool.
Moreover, if for any reason you can’t use phpMyAdmin you may use it’s lightweight, yet powerful alternative Adminer that comes in as a single PHP file.
This method is the recommended way to regain access to your WordPress site if you are not able to log in to the WordPress admin panel.
To do this follow these steps:
Editing the WordPress database directly could easily break your website if not done correctly. So, if you can’t do it hire a developer.
And always make sure to take a backup of your database before editing it.
Login to your hosting cPanel and open phpMyAdmin.
Select the database of your WordPress site from the left sidebar.
Select “wp_options” table
Note: “wp_” prefix may differ depending on your WordPress installation settings.
On the right, click Edit beside either the siteurl or home entries.
Enter the correct values in the
option_value fields, then click Go.
There is no step 6 🙂
Go ahead and try to access your WordPress site and log in to the WP Admin panel.
Now I’ve covered the two easiest methods to manually change your WordPress site URL.
They will help you regain access to your website and the WP Admin dashboard if you can’t access it after changing the WordPress site URL.
If none of the methods could help you fix the problem or just want to say hi! don’t hesitate to let us know in the comments below.