4

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?

3

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.

define('WP_HOME','http://example.com');
define('WP_SITEURL','http://example.com');

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:

define('RELOCATE',true);

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).

2

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:

UPDATE wp_options SET option_value = 'http://www.newdomain.com' WHERE option_value = 'http://www.olddomain.com'

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

0

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.

1
  • Even changing the Site and WordPress addresses in "Settings > General" is proving problematic because all redirection and links right from the login page are wrong, but I like your suggestion of getting it running locally.
    – ProfKaos
    Dec 12 '10 at 5:12
0

today... sedoparking hogged one of my domain that i planed to renew (this is evil).

thanks hakre! that really really helped!

  1. did the fix wp-config.php

    define('WP_HOME','http://new-domain.com'); define('WP_SITEURL','http://new-domain.com')

  2. now can login to http://lost-domain.com/wp-admin (a lot of links will still be pointing to lost-domain.com)

  3. install this plugin https://wordpress.org/plugins/duplicator/ highly recommended! (Open Source FOREVER!)

  4. create an backup archive with the plugin (download installer.php and archive.zip, store at safe place)

  5. (s)ftp upload it to new-domain.com

  6. run new-domain.com/installer.php

enter image description here

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! :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy