Help! I changed the domain of a website and now it sends me to a 404 error when i try to access my admin page. I don't have the files backed up. What can I do to reverse this?
Here are two options for you:
1) Do you have access to the WordPress database via PhpMyAdmin or similar? If so, you can change the information via the wp_options table in
home (inside the option_name column). Change both those and you should be good to go.
WARNING! If you make the change in the database be VERY careful not to touch anything else or you might mess up your whole WP database. I've attached screenshots so you can see the correct table/row to edit.
A good rule of thumb is, if you don't know what it is, don't touch it. If you don't feel confident doing this, try option 2.
2) Do you have access to the hosting account or FTP? If so you can hard code the domain into WordPress in the wp-config.php file.
define( 'WP_SITEURL', 'http://yourdomain.com');
define( 'WP_HOME', 'http://yourdomain.com');
Save and/or upload the file and you should be able to log back into your system.
Important! This setting doesn't actually change the database settings, so if you delete the two lines of code you added to wp-config.php, you'll be back at square one. Only delete if you are able to eventually change the database (once you have defined
WP_HOME, you can no longer update those values in the database through WordPress)
Explaination from the WordPress codex:
"NOTE: It won't change the Database value though, and the url will revert to the old database value if this line is removed from wp-config. Use the RELOCATE constant to change the siteurl value in the database."
You can learn more about customizing the wp-config.php file here on the WordPress codex page
The above answer is actually the best answer, but if you're really wanting to change the domain name of your website permanently, you'll want to run a serialized search and replace script, which can be uploaded to your WordPress install root and ran through an internet browser.
It will grab your database credentials from the wp-config.php file automatically, you'll just want to enter the old URL and replace it with the new one on the second to last step. Remember, this is not reversible and you should only replace the smallest common value (e.g. replace oldtest.com with newtest.com, not http://oldtest.com/ with http://newtest.com).
This will update all instances of your URL, including attachment paths, which will be important if you're not running a root relative installation.
This is the tool I use, just be sure to delete it from your FTP when you're done.