WordPress - moving from one host to another

前端 未结 6 1510
走了就别回头了
走了就别回头了 2020-12-11 14:11

I am trying to move a WordPress installation from one server to another one, including all of the SQL data, and the file-system data (photos,template files).

I just

相关标签:
6条回答
  • 2020-12-11 14:37

    This is a really straight forwarded procedure with no frills but extremely detailed for newbies

    • Make a full wordpress backup from your local server/host using cpanel. (wp + db)
    • download the backup1.tar.gz generated
    • Install a new wp site (default theme) on the target host. Same release, please!
    • warning: If they are different, leverage both releases.
    • Make a full wordpress backup from your target host using cPanel. (wp + db)
    • download the backup2.tar.gz generated
    • Additionally backup (export) wp-admin and wp-users target mysql backups; save them for future use ahead.
    • enter target host cPanel > file Manager > enter wp diretory > clear all files
    • upload local host wp backup1.tar.gz files to target host wp directory > extract files
    • copy wp-config.php file from backup2.tar.gz file
    • paste overriding wp-config.php file on target host wp directory
    • enter target host > cpanel > phpmyAdmin > find mySQL BD name of your target wp host and drop all tables.
    • restore (import) local wp using backup1.tar.gz softsql.sql file to mySQL db on target host
    • drop wp-admin and wp-users tables after restore. Restore (import) wp-admin and wp-users you saved before. This will guarantee target wp authentication when entering target host wp administrative tasks.
    • test target host wp url
    • The wp-config.php copy/paste is to restore target host wp and mySQL original authentications.
    • Test target wp at /wp-admin mode.
    • that's it! Enjoy.
    0 讨论(0)
  • 2020-12-11 14:38

    I think the guy is talking about hard links in his page/ post content. You need to apply @markratledge MySQL replace function link this...

    UPDATE wp_posts SET post_content = REPLACE(post_content, 'http://www.old-domain.com', 'http://www.new-domain.com');

    This will replace all the links in you post/ page content...

    0 讨论(0)
  • 2020-12-11 14:42

    There is indeed a REPLACE() function in MySQL, but I would recommend doing what hsatterwhite suggests and editing the whole MySQL dump as a flat file before re-importing, not least because the REPLACE() function is case sensitive.

    0 讨论(0)
  • 2020-12-11 14:44

    You could simply dump the mySQL in a flat file and open it up in your favorite editor. Than do a find and replace for fully qualified domain name if you are literally change domains. That should take care of WordPress specific URL settings as well, so all your links in pages, posts, sidebars etc. will work. Also be sure to change the local path's recorded in the DB to reflect what the new ones will be as well.

    Once your done import the mySQL file in to the new DB and have at it. If something when wrong in transit than you'll definitely know. :)

    0 讨论(0)
  • 2020-12-11 14:48

    Edit 5/16/2015

    It's much better to use interconnectit.com WordPress Serialized PHP Search Replace Tool to find/replace URLs in the database and to correctly deserialize/reserialize that data. Doing a find/replace in a text dump or with the UPDATE queries below will break serialized data.


    Several easy ways: How to Move WordPress Blog to New Domain or Location » My Digital Life:

    UPDATE wp_options SET option_value = replace(option_value, 
    'http://www.old-domain.com', 'http://www.new-domain.com')
     WHERE option_name = 'home' OR option_name = 'siteurl';
    

    and others: How to Find and Replace Text in WordPress MySQL Database using SQL When Changing Domains » My Digital Life

    Search RegEx « WordPress Plugins for grepping through posts and pages as a WP plugin-based way to replace image and other URLs in posts and pages.

    And there's Moving WordPress « WordPress Codex.

    0 讨论(0)
  • 2020-12-11 14:49

    One thing to be aware of is that WordPress stores some of it's data using serialised arrays (some plugins in particular, such as cforms, do this).

    In instances where the site URL data may be serialised, simply updating the site URL text can change the length of data in the serialised string, corrupting the data and breaking things.

    Interconnectit have a php script that takes serialisation into account when doing a search replace in the WordPress database. Github repo of the script here.

    I have used this script in numerous WordPress migrations and it has been a lifesaver for me.

    0 讨论(0)
提交回复
热议问题