A few months ago I put together a site using Wordpress for a friend, I developed it on localhost and exported it to his live site paulscreen.com
I have recently been asked to do the same for someone else and I set about it the same way, my problem is at some point I accessed paulscreen.com (I don't know how or when) and in doing so I have set his site to viciousnature.co.uk, I assume by changing the home url in the options panel in the admin area.
Now when I try to access the admin area for the first site, I get redirected to the second. I have been going through the wordpress code, but only have limited coding knowledge and cant find how to fix the mess up.
Where do I find the option to edit the home url, without using the admin area?
I would prefer to go with the wordpress rules :)
Because you never know what wordpress does behind the scene, I wouldn't hack wordpress database.
Simply you update your vhosts and put the live domain to point to your local ip address. After that wordpress still redirects you to the live url but this time you see the local project.
Login to the admin panel. Go to settings and change the WordPress Address (URL) and Site Address (URL) with your local url. Save the changes. Edit the vhosts file and remove the live domain.
Now you can access the local project putting the local url.
Note: when you want to import the local database into the live server, don't forget to do the same visa versa.
Whoops. Make the change to the database directly through phpmyadmin. Login into the panel for the server and look in the database table
wp_options
(assuming you never changed the default prefix, if you did it'll be yourprefix_options).It's the
siteurl
option, if you browse the table it's right at the top. If you don't have panel access anymore for whatever reason, and only have FTP then you can upload adminer.php and use that to change the siteurl option from your browser.See Changing The Site URL « WordPress Codex for different methods to recover. You don't necessarily have to be able to get into WordPress administration backend.
The easiest quick fix is add these
define
URL directives in wp-config.php:with the URL of the new domain, and those will override the URL settings in the database and the old domain. You're hardcoding the URLs and you won't be able to edit them on the General settings page anymore after using this method, but that will get you back into the site.
If you need to change domains when moving a site and database to a new domain, you need to use queries in phpmyadmin to change all URLs in the database, i.e. those site URLs, as well as in theme options, in post content, etc.
Important Update 2/20/2017:
When moving a site and a database to a new URL or domain, it's now best to use this - interconnectit.com WordPress Serialized PHP Search Replace Tool - rather than queries directly in PHPMyAdmin that I posted above. The Interconnectit tool will correctly handle serialized data in the database, such as used by Wordpress themes and plugins; using those queries in PHPMyAdmin will break such data, such as used for theme options, widget settings, etc, and you will have to reset all those options afterward, which can be a mess.