A caveat to start with…

As I have followed the steps in my other post (How to create a local version of your remotely hosted WordPress website), I started with a local WordPress website that was a direct duplicate of my remotely hosted website. So, when it comes to transferring back to my remote host, I don’t have to worry about overwriting the remote files. It’s worth noting that my remote website was not live and so no changes or new content was produced on the remote website and so I didn’t have to worry about losing this or even the effect to anyone who might visit the site.

1: Upload the contents of your local « wp-content » folder to your remote hosting

1&1 Web Hosting

  1. With 1&1 web hostinglogin to your Control Panel, and look for Secure FTP Account under Manage Webspace and this will take you to a list of FTP accounts for your account.
  2. You should have an account listed on this page that has a Personal Note of « Main user for SFTP and SSH » – this is the account you are interested in. The username is shown in the 1st column and if you do not know the password for this account you can reset it by clicking the 3 dots under « More », « Edit Settings » and then clicking on « Password ».
  3. Under the list of accounts is the « Connection Data » that you need to put into your FTP software in order to establish a connection to 1&1 – on Mac, I like to use CyberDuck.
  4. Having established a connection, you then need to find your website files – I installed WordPress on 1&1 using the Click and Build tool and so I just need to open the « clickandbuilds/etalented/wp-content » folder.
  5. Then, in CyberDuck, right click in this folder, choose « Upload… » – this will launch a Finder window in which you need to locate the « wp-content » folder of your local WordPress website.
  6. Select every folder inside the « wp-content » folder (except any files e.g. index.php or php.ini) and then hit Upload! You should be asked if you wish to overwrite the folders on the remote host, so say « yes » to all folders if that happens.
  7. You should now see the upload to your remote host happening…and that’s what you want 😀

2: Modify your SQL file before import

MAMP

  1. If you are on Mac, and using MAMP, then visit http://localhost/phpmyadmin/.
  2. Select the relevant database and select « Export » in the header.
  3. Then just hit « Go » to begin the export process as the default options are usually correct.
  4. Then open up the file that was created in your favourite text editor (I like to use TextMate).
  5. You then need to do the same find and replace that I have detailed in my other post (How to create a local version of your remotely hosted WordPress website) only in reverse – you need to replace all occurrences of localhost with the remote host (e.g. etalented.co.uk) as follows:
    1. Firstly, look for all occurrences of http://localhost and replace it with https://theeasyweb.co.
    2. Replace all occurrences of http:\\/\\/localhost with http:\\/\\/etalented.co.uk.
    3. Replace all occurrences of "//localhost with "//etalented.localdev.
  6. Save the file when you done.

3: Login to your remote phpMyAdmin and import your database

1&1 Web Hosting

  1. If you are with 1&1 web hosting (like me), login to your Control Panel, look for MySQL Database under « Manage Webspace » and this will take you to a list of databases that you have in your account.
  2. Find the relevant database for your account and then click the « phpMyAdmin » button beside it – you should now have phpMyAdmin open in a new tab or window in your browser.
  3. In the sidebar, click on the name of your database and you will see all of the database tables load.
  4. You now need to remove all existing tables in the database (which is fine…see the caveat above), which can be done by scrolling to the bottom of the page, clicking « Check all », and then in the « With selected: » dropdown menu, select « Drop ».
  5. You will then be asked to confirm this action, so just select the « Yes » button.
  6. Once this is done, click « Import » in the header.
  7. Select the « Choose file » button and locate the file that you modified earlier. Don’t worry about any other options – you can leave them as default.
  8. You can now hit « Go »! This will recreate all of the tables from your local database in your remote database including all of the data.
  9. After a little loading, you should see a message saying « Import has been successfully finished »…and that’s what we want 😀

4: Use the WordPress Export and Import

You may not need to do this step! The steps above should be enough for you to have your local WordPress website transferred successfully to your remote host, however, I do find sometimes that the content does not replicate correctly such as by having « \r\n » as text content when it should actually be a new line in the text. So, if you too have the same issues with your content, then I suggest you follow the steps below.

4a: Remove all content from your remote WordPress site

The purpose of this is to prepare your remote website for a WordPress import that is going to happen in Step 2 – it sounds drastic but it is necessary to start with a « blank canvas » for the import to work successfully. Everything that needs to be removed, is everything that is going to be imported by the WordPress Importer, which is usually posts, pages, comments, custom fields and categories etc – but first we need to clarify what that is!

  1. Go to « Tools », « Export » in WP Admin in your local site.
  2. On this page under the heading « Choose what to export » you will see a list of content in a line under « All content » (posts, pages, comments etc) and then afterwards a list of content with radio buttons next to them (Posts, Pages, Contact Forms etc) – it is all of these items that you need to remove from your remote WordPress site so make a list of them!
  3. Now, you need to go to the WP Admin in your remote site.
  4. For Posts, go to the Posts page, select either the checkbox in the header or the footer and then in the « Bulk Actions » dropdown, select « Move to Bin » and then hit « Apply » – this just moves your Posts to the Trash Bin (just like on your computer) and so they are not yet permanently deleted.
  5. Now select « Bin » at the top of the page, and hit « Empty Bin » at the bottom of the page.
  6. For Pages and Comments, you just need to repeat steps 4 + 5 on the Pages and Comments page.
  7. For Categories and Tags, go to either page, select the checkbox in the header or the footer and then in the « Bulk Actions » dropdown, select « Delete » and then hit Apply – they will be deleted straight away.
  8. For any other content that is on your list to be removed, please go ahead and do so 😀

4b: Export and Import your content

  1. Go to Tools, Export in WP Admin in your local site.
  2. Select « All content », hit the « Download Export file » button and the export file should begin downloading.
  3. Go to Tools, Import in WP Admin in your remote site.
  4. Find, « WordPress » on the page and select « Run Importer ».
  5. Select « Choose file » and locate the file that you just downloaded.
  6. Hit « Upload file and import » and you will be taken to a confirmation page.
  7. You will then be taken to a confirmation page regarding assigning authors and importing attachments – you do not have to make any changes here as the author will be correctly assigned (as the remote site is now just a copy of local) and all the attachments were imported already.
  8. Hit « Submit » and the import should then commence.
  9. When it has finished, you will presented with a report of failures…if they are no failures then it was all successful. However, if there are failures then it is likely to be about failing to create posts or pages because they exist already i.e. you haven’t correctly deleted all content before importing (see above) 😀

Your done!

You should now have a fully working live version of your local website – load your live website and see if it works!

Are you having problems creating a local version of your live website? Then my other post about How to create a local version of your remotely hosted WordPress website may help you.

Copy link