Problems with moving my Wordpress site to another

2019-04-15 15:27发布

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!

5条回答
你好瞎i
2楼-- · 2019-04-15 16:11

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

查看更多
Bombasti
3楼-- · 2019-04-15 16:12

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

查看更多
乱世女痞
4楼-- · 2019-04-15 16:15

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

查看更多
你好瞎i
5楼-- · 2019-04-15 16:18

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

查看更多
霸刀☆藐视天下
6楼-- · 2019-04-15 16:25

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
查看更多
登录 后发表回答