One of the most common WordPress errors is having a problem accessing WordPress after you change your site URL in 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 teach you how to fix the problem and how to change your WordPress site URL in order to be able to access your website 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 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. There are 2 ways to do that:
- Change WordPress site URL by editing
- Change WordPress site URL via phpMyAdmin.
First Way: Change WordPress site URL by editing wp-config.php file
In this way, you will need to edit your
wp-config.php file and add 2 lines of code to it and your WordPress site URL will be changed. To solve the problem by this way, follow the following steps:
Login to your WordPress hosting cPanel and open cPanel File Manager
Open File Manager and search for a file called
wp-config.php and click on “Edit file”.
Add the following code to the end of
wp-config.php file and save the file.
define('WP_SITEURL', 'http://www.example.com'); define('WP_HOME', ' http://www.example.com');
www.example.com with your site domain.
That’s all, try to access your website now.
Second Way: Change WordPress site URL via phpMyAdmin
The second way to change WordPress site URL and solve the “Can’t access WordPress after changing site URL” problem is to change the site URL from WordPress database manually using phpMyAdmin.
To do this follow these steps:
You’re advised to take a backup of your database before editing it.
Login to your hosting cPanel and open phpMyAdmin.
Select your WordPress installation database from the left.
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 new value in the “option_value” field, then click Go.
Nothing to do in step 7, just go now and try to access your WordPress admin panel.
Now I’ve covered two ways to change your WordPress site URL manually to fix the “Can’t access WordPress after changing site URL” problem and make you able to access your WordPress admin area again.
If you faced any problem, don’t hesitate to let me know in comments below!