Reputation: 69
I'm having problems moving a wordpress site from one domain to another. I've searched the site but couldn find a useful answer for my situation.
Here's what i did:
I made a backup of the website. Then i exported the database. Then i installed Wordpress on the other domain. Then i copied all my Wordpress files of the old website on the new server overwriting the new installation. Then i deleted everything from the database on the new server and imported the database of the old server. Then i changed the database name and bpassword in the wp-config file.
So i did all this but the new site isn't working, and i don't know where it went wrong? So i'd like to start over, but what should i do different?
Thankyou for your help!
Upvotes: 1
Views: 2086
Reputation: 17561
You can run these sql queries in phpmyadmin to change URLs in the database after the move for site options, post URLs and URLs in post/page content:
UPDATE wp_options SET option_value = replace(option_value, 'http://olddomain.com', 'http://newdomain.com') WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET guid = replace(guid, 'http://olddomain.com','http://newdomain.com');
UPDATE wp_posts SET post_content = replace(post_content, 'http://olddomain.com', 'http://newdomain.com');
4/22/2014 Edit: this is a much better solution that won't break PHP serialized data: interconnectit.com WordPress Serialized PHP Search Replace Tool
Upvotes: 4
Reputation: 53
There is also a tool available for those who are not confident running SQL update scripts, found at:
Search and Replace for WordPress DB
Remember to delete files after performing the desired actions to the DB, because the script exposes DB username/password found in wp-config.php ;)
Upvotes: 0
Reputation: 11
Instead of installing Wordpress on new server. Copy old files to new server, import database and change wp-config. I found this helpful How to Transfer a WordPress website to another Host
Upvotes: 1
Reputation: 751
The main thing you need to do is update 2 fields in the database to the correct domain.
It can be done a few different ways.
Method 1:
Add this line to your wp-config.php file, then visit http://yournewdomain.com/wp-admin.php and log in. This will force the update:
define('RELOCATE',true);
After you log in, you should remove that line.
Method 2:
Add these 2 lines to your theme's functions.php file found at wp-content/themes/themename/functions.php
update_option('siteurl','http://example.com/blog');
update_option('home','http://example.com/blog');
After that, you need to update the GUID for each post. In phpMyAdmin or from the mysql command line issue this:
UPDATE wp_posts SET guid = REPLACE (
guid,
'http://exampleoldsiteurl.com',
'http://examplenewsiteurl.com');
replace exampleoldsite and examplenewsite with the respective domains.
All of this info can be found at http://codex.wordpress.org/Changing_The_Site_URL
Upvotes: 3
Reputation: 2206
You will probably need to edit some fields in your database and update the settings in the admin area. There is quite a nice guide here
http://codex.wordpress.org/Moving_WordPress#Moving_WordPress_to_a_New_Server
I think the easiest way is probably:
- Install a new Wordpress blog
- Go on old blog Admin panel. Here, in Manage > Export select "all" in menu Restrict Author.
- Click on Download Export File
- In new blog go on Manage > Import, choose Wordpress item.
- In the page that will be shown, select the file just exported. Click Upload file and Import
- It will appear a page. In Assign Authors, assign the author to users that already exist or create new ones.
- Click on Submit
- At the end, click on Have fun
Upvotes: 2