I have a WordPress blog for which the domain name has expired. I can still nearly access the blog via a new domain name at the same host, but it seems like the original domain name is quite solidly baked into WordPress. Every time I get WordPress to serve just one page, all links on that page still point to the old domain name.
What is wrong with relative URL’s is another question for the WordPress team, but my real question here is how can I recover my blog and reopen it under a new domain name?
If you have problems to log even into your blog, edit wp-config.php:
Add these two lines to your wp-config.php, where “example.com” is the NEW location of your site.
This will at least make it useable again (but won’t fix links inside post and page content, see Ticket #4003). .
Additionally you can add this third line:
Then go immediatly to
http://example.com/wp-login.php
and login as normal. When the RELOCATE flag is set to true, the siteurl (NOT the home setting) will be automatically updated to whatever path you are using to access the login screen. This will get the admin section up and running on the new URL, but it will not correct any other part of the setup. Those you will still need to alter manually. (Source)More information on how to change the URL can be found in Changing The Site URL (WordPress Codex).
You can fix this by changing the site URL directly in the database. You can either use the mysql client or phpMyAdmin to issue the necessary query:
If you had the blog running at a subfolder, make sure to include that in the old URL as well. Once you run that query everything will stop redirecting you to the old domain.
This is the same as the “manual” method here:
http://codex.wordpress.org/Changing_The_Site_URL
You mean after changing the Site and WordPress addresses in
Settings
>General
you still have this problem? This seems like a pretty serious bug, but may be a design limitation of WordPress. Either way, it’s probably wise to report it upstream.To address your problem: backup the database and run an update to replace any references to the old URL with the new one, in case some things have been committed to the DB. I think that should solve any issues you see (clear the caches as well, if applicable).
A slightly more hackish way would be to clone both WordPress and the database locally, then change your hosts file to claim your old URL resolves to 127.0.0.1 and run the server locally. With that going, you can export WordPress wholesale and import the resulting file in a new installation, which would be under the new domain.
today… sedoparking hogged one of my domain that i planed to renew (this is evil).
thanks hakre! that really really helped!
did the fix wp-config.php
define(‘WP_HOME’,’http://new-domain.com‘);
define(‘WP_SITEURL’,’http://new-domain.com‘)
now can login to http://lost-domain.com/wp-admin
(a lot of links will still be pointing to lost-domain.com)
install this plugin https://wordpress.org/plugins/duplicator/
highly recommended! (Open Source FOREVER!)
create an backup archive with the plugin (download installer.php and archive.zip, store at safe place)
(s)ftp upload it to new-domain.com
run new-domain.com/installer.php
this will search and replace all old and thus broken links in the database
now you should have your old wordpress back online under new-domain.com in full glory! 🙂