2

Good day!

How do you properly migrate your localhost wordpress file to a live server? What I do is usually copy all my wordpress file then transferred to my website thru FTP and the database is usually imported to the target sql.

The problem is when I do this, the website layout gets all messed up. I wanted to migrate my website without the layout being affected.

Thanks.

5
  • You can try WP Migrate DB plugin to export your database to move it to live. It will not break the site.
    – Bhupen
    Commented Jun 3, 2019 at 8:12
  • I would just use the export/import tools that come with WordPress. Commented Jun 5, 2019 at 11:51
  • @Valentin Genev that only transfers the content. Not the theme or the plugins or the plugin settings. Commented Jun 7, 2019 at 0:39
  • @PothiKalimuthu Ah, I see! So the other solutions should migrate everything even if the developer doesn't have FTP account? Commented Jun 8, 2019 at 9:24
  • @Bhupen I have tried using WP Migrate DB, not all is being transferred. Commented Jun 10, 2019 at 2:12

3 Answers 3

2

You can use the WP CLI too to rename your site's hostname safely and effectively. There's a chance that your layout is being messed up because naively replacing the domain name with a simple string replace, e.g. perl -pi -e 's/oldhost/newhost/g' backup.sql, will not take into account things like serialized data.

Try this on your local machine after install WP-CLI:

Using the db-checkpoint package:

wp package install binarygary/db-checkpoint
wp dbsnap pre-search-replace
wp search-replace --precise oldhost newhost
wp dbsnap post-search-replace
wp dbsnapback pre-search-replace

Now, take the file in wp-content/uploads/checkpoint-storage that starts with post-search-replace and import that to your remote host.

Without db-checkpoint:

# Backup your database here, this will be restored to your local once the
# operation is done
wp search-replace --precise oldhost newhost
# Take another backup now - this backup will go to your remote server
# Now, restore your original backup to have your local in a working state...
# OR do this:
wp search-replace --precise newhost oldhost
0

Make sure to also change the site URL in your database under the wp_options table. And it should work.

2
  • I always make sure to do that yet my website still got this messy layout as opposed to my local website. Commented Jun 3, 2019 at 6:46
  • try to enable the debugger and check if you get any errors
    – magefms
    Commented Jun 3, 2019 at 6:50
0

I always recommend https://wordpress.org/plugins/duplicator/ to move your entire site. It makes the process really easy and also takes care of any database replacements needed during migration.

1
  • I have tried duplicator, not migrating everything. Commented Jun 10, 2019 at 2:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.