Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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, when I 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?

share|improve this question

migrated from webapps.stackexchange.com Dec 25 '10 at 1:46

This question came from our site for power users of web applications.

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

share|improve this answer

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

share|improve this answer

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.

share|improve this answer
    
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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.