How to push wordpress from mamp into hostgator

It’s quite easy to deploy a local version of WordPress to a live server. First of all, you are right, I would not bother installing a clean copy of WordPress on your server, you’d then have to totally rebuild the site.

What you need to do is;

  1. FTP all your files from your local machine to the server.
  2. Transfer the whole database from local phpmyadmin to a new database on the server
  3. Change the database connection details in wp-config.php
  4. Make any necessary changes to your default WordPress .htaccess. What I mean here is that your MAMP site probably isn’t in the root but your live site probably will be. If you have SEO permalinks set up then you would remove the Mamp subdirectory from the rewrite rule and the base in the .htaccess. Your host might also require you to add rules here (ie specifying which version of PHP to use etc). You could always install WordPress using their installer to see if they add any special rules themselves.

All easy so far – now comes my tip. Moving WordPress databases from your local development environment to live can be a massive pain because WordPress (and lots of plugin/theme developers) use serialized arrays to store data. So if you do a find-and-replace on the database to replace your old url with the new one, you will disable lots of things like config settings and widgets (text widgets specifically, but there’s loads of stuff you end up having to recreate).

Download this file;

http://interconnectit.com/124/search-and-replace-for-wordpress-databases/

and upload it to the server and access it directly in your browser. Run through the quick form and perform a serialized array-friendly find and replace on your database urls. Job done. Good luck.

Leave a Comment