how change domain in wordpress 3.3.1?

Status
Not open for further replies.
2 comments
1. Run the sql commands below to update your database.

Change site and home URL
Code:
UPDATE wp_options SET option_value = replace(option_value, 'http://www.oldsite.com', 'http://www.newsite.com') WHERE option_name = 'home' OR option_name = 'siteurl';

Change GUID
Code:
UPDATE wp_posts SET guid = REPLACE (guid, 'http://www.oldsite.com', 'http://www.newsite.com');
Change URL in post content
Code:
UPDATE wp_posts SET post_content = REPLACE (post_content, 'http://www.oldsite********', 'http://www.newsite********');

Update post meta
Code:
UPDATE wp_postmeta SET meta_value = REPLACE (meta_value, 'http://www.oldsite.com','http://www.newsite.com');

Those should cover most things. There may be other queries you need to run or manually change in WordPress for things like widgets.

2. Setup a 301 permanent redirect on your webserver

It is pretty simple on nginx. Just add the following to your vhost.

Code:
server {
    server_name  oldsite.com www.oldsite.com; 
    rewrite ^(.*) http://www.newsite.com$1 permanent;
}

There is similar code for Apache that you add to your .htaccess file, but I can't be bothered to look it up.

3. Notify Google of the URL change

Login to Google Webmaster Tools and, if you haven't already, register and verify your old website. Do the same for your new website.*

Then select the option in the control panel and tell Google which domain to change too (it can take 180 days for the process to complete).

*You may need to do this for yourdomain.com and www.yourdomain.com

4. Sit back and relax
 
Last edited:
Status
Not open for further replies.
Back
Top