Taking Your Development Site Live
WordPress v.3.3.2, pypMyAdmin V: 220.127.116.11, MySQL client version: 5.1.62
You may want to create a site in a development environment rather than working on a live site. (No Cowboy Coding allowed). This ‘dev’ site would then have to be moved to a production site when it is ready to go live. Here are steps to follow when moving a site to a new location.
Overview: Four Steps
- BACKUP: Backup development site manually or with the backWPup plug in
- INSTALL: Make new WordPress install on server in new location
- IMPORT: Import your backed up site into the new WordPress Install and update paths to db and uploads
- LOCATE: Tell the new install, the location of the new db and login and change login and password
There are 2 parts of your WP install to back up when you are moving a site.
- Your mysql db
- The ‘wp-content’ folder which includes all customizations. More specifically, your WP php files, plugins, themes, customizations and all media files you have uploaded.
1. Backing up the mySQL db
phpMyAdmin is a small application that serves as a front end to the mySQL databases living at your web host. This app allows you to access and work with the WordPress Database that is installed on your web host’s server when you do a new install of WP. Follow thsese steps to export the WordPress MySQL db as a .sql file.
- Log into your web host.
- Go to cpanel>phpMyAdmin to connect to the mysql db.(Note: Some hosts don’t use cPanel, so you have to navigate once you have logged into your web host to find your mySql DB. (wp-config.php has the password to phpMyAdmin))
- In the left sidebar of phpMyAdmin, select the mySQL db you want to export. (Note the name of the db.)(don’t touch ‘information schema’ db if you see it.)
- At the top of the screen, Click Export, and then>Custom for the kind of Export.
- Once you have clicked ‘Custom’, you will get some options. Scroll down to: ”Object creation options>Add statements:” Check the following option: “add/drop table. See: Add DROP TABLE / VIEW / PROCEDURE / FUNCTION / EVENT statement.” This will tell mySQL to drop any new tables in the new database when it is importing the backed up db to your new install.
- Click ‘GO’. This will download a database file called name_of__db.sql to your downloads folder or Desktop.
2. Backing up your WP php files and media files (images videos, pdfs, etc.)
The wp-content folder holds all your Themes, child themes, plugins, customizations, uploads, (videos, images, .pdf files) that you have added to your site.
- Log into your server (your webhost) with an FTP application. (Cyberduck, Transmit, Filezilla, etc.)
- Drag the wp-content folder onto your Desktop to back it up.
Alternative backup system: Use the backWPup plug in.
BackWPup plug in allows scheduling, back up to DropBox and and other cloud servers. Note: When using the backWPup plug in, it is best practice to create 2 jobs rather than one big job. Job 1 is the db backup, and job 2 is the files backup.
Make New WordPress Install
Do a brand new install of WP into a folder called ‘sandbox’ or into client’s directory where they will host the new site. Note: As an alternative to using a “sandbox folder for development sites: use subdomains for ea. WP install. Each subdomain would be a new install of WP subdomain.domainname.com. Note: If you are using this plug in, Now that you have created your new WP install, skip down to “Restore using backWPup plugin”.
Bring In Dev. Site To New Location
- Import wp MySQL Db From dev site
- Import the mySQL DB you exported to your downloads directory or folder on your computer. Here’s how: Go back to your webhost, open phpMyAdmin, in left sidebar, select the name of the database of the new install, click Import, navigate to the .sql file you exported to your downloads folder to upload it
- Once the file has uploaded, click “Go”.
Replace Wp-Content Directory On New Install With The wp-content Directory From The Dev. Site
The wp-content folder holds all your personalized content from WordPress installations.On your new install, replace the existing content. This installs the media library and any other content.
- Log into your server (your webhost) with your FTP application. (Cyberduck, Transmit, Filezilla, etc.)
- Drag the WP content folder onto the WordPress folder. It will replace the wp-content folder that was installed at the time of the new WP install. This will bring in your customized content.
Tell The New Install’s DB, The Location Of New WP Install
Edit 3 fields in the Options Table of your mySQL db. Record numbers are approximate.
- SITEURL: Edit record one, change it to new directory: Here is how: In phpMyAdmin, Select the new mysql db that was installed with your new install. In left sidebar where the list of tables are, select wp_options. (these record numbers might change): Change record 1- Options table tells wp where your files live. (This is the same as wp address in General Settings in Dashboard). e.g. if you have a subdomain setup, it will be something like, subdomain.domainname.com/wp. Or dev.domainname.com, or domainname.com/sandbox/wp/
- HOME OPTION: Edit record 37: Options table->possibly record 37 or 39.>site address. Change this to your new directory. Click Go to set your edit.
- UPLOAD PATH OPTIONS: Edit Record 56- change upload path. This is the directory that your media will go to: e.g. (/home/yourdomain/public_html/sandbox/01/wp-content/uploads. this example has a new subdomain name called dev, for the new install. /home/username/public_html/dev/wp/wp-content/uploads. Click “Save” and “Go” to save your edit.
At This Point, You Should Be Able To Log Into Your Dashboard
Change Login And Password:
Edit users table: change user login and password, must have old one to login to site after setup
Install The Search And Replace Plug In
Will let you go into the content urls and change from the old site to the new site. Note: if you have changed the permalinks (Dashboard>Settings>Permalinks), you may have to make the same changes in your new site to avoid 404 messages). Also, if you have any external links in a post, these may have to be relinked manually as the Search and Replace Plug in only searches the WP db.
Alternative Restore System: Restore using backWPup plugin
After creating the new wp install, restore files from the backWPup files into your new WP install. Assuming you created two jobs, a db backup and a files bu, first restore the db .sql file and then the files backup:
- Unzip db backup and locate the .sql file.
- Login to Dashboard in the new install. Go to Dashboard>backWPup>Tools. Choose the .sql backup file to import and click the Upload button. Once it has uploaded, click the ‘Import’ button.
- Locate the Files backup, unzip it and copy it to the new install via your FTP client replacing the wp-content of the new install.
Other Things To Think About
Visibility For Working Not Published Sites
If this is a development site, we Don’t want it to be visible: Go to privacy under settings>block search engines.
Password protect entire site while in development
To available to anyone at all, there is a plug in for that. so it is password protected.Or, the ‘Members only’ plug in password protect your site while you are developing it.
Other Options for a working site:
Install wp on your computer rather than a web host. BUT: You can’t show it to the client unless you bring your laptop to him. (possibly join.me would work?) You have to run a web server like MAMP.
Or: With WP, make a static page that says, coming soon, and other pages would be password protected.
Other Options For Moving Sites
Back up buddy plug in
One other way TO MOVE WP INSTALLS is to use backupbuddy– about $75/year for two sites. 10 sites/ BackUP Buddy provides one button solutions, is very convenient for those doing a lot of installs and moves.