If you’ve lost access to your WordPress site because you moved the WordPress files in or out of a subfolder or subdomain, made a mistake when filling out the WordPress “General Settings” or simply transferred your domain name and need access to the previous site, you’re not totally up the creek! The following is a hack that you can use to restore access to your blog.
Access your site files via FTP and edit the wp-config.php file. I generally place it just above where you define the database is, which makes it the first two uncommented lines in your wp-config.php file.
Add these two lines to your wp-config.php, where “example.com” is the NEW location of your site.
define('WP_HOME','http://example.com'); define('WP_SITEURL','http://example.com');
This is not the best fix: it’s just hardcoding the values. You won’t be able to edit them on the General settings page anymore when using this method, but when you’re desperate, this is a good hack to gain access!
Thanks so much to filosofo and WordPress.org for sharing this hack!
I use this ALL the TIME.
This is great for transfers.