By ProfKaos


2010-12-12 04:11:09 8 Comments

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?

4 comments

@canoodle 2020-01-21 09:20:35

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

@hakre 2010-12-26 03:09:12

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

@alexandru 2010-12-12 04:30:59

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.

@ProfKaos 2010-12-12 05:12:49

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.

@Dan Grossman 2010-12-12 08:36:10

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

Related Questions

Sponsored Content

2 Answered Questions

[SOLVED] Migrating WordPress - New domain entry, links broken

2 Answered Questions

[SOLVED] Wordpress migration to new domain and environment with only zip file

  • 2019-06-08 05:10:18
  • navarrofrancisco
  • 28 View
  • 0 Score
  • 2 Answer
  • Tags:   migration

4 Answered Questions

[SOLVED] WP redirects all pages from new domain to old domain

1 Answered Questions

[SOLVED] Wordpress Domain redirects to different host

4 Answered Questions

[SOLVED] Export WordPress from one domain to another domain

1 Answered Questions

2 Answered Questions

how to move a wordpress blog to my static site

  • 2013-11-13 02:11:19
  • Chris
  • 142 View
  • 0 Score
  • 2 Answer
  • Tags:   migration

1 Answered Questions

Migrating domain name from old WP host to new (which uses vhosts)

2 Answered Questions

Sponsored Content