How Nexcess clients on physical (non-cloud) servers can create development (dev) WordPress sites.
What you need
- A working, preferably current installation of WordPress
- A Nexcess account on a physical (non-cloud) server and access to SiteWorx; If you use Nexcess Cloud, see instead What are Nexcess Cloud dev sites? for details about dev site creation
- MySQL, or phpMyAdmin access through SiteWorx
- SSH (recommended, FileZilla, or a similar file-transfer utility
ATTENTION: This method is intended only for Nexcess clients on physical (non-cloud) servers. If you use Nexcess Cloud, see instead What are Nexcess Cloud dev sites? for details about dev site creation.
- Create the secondary domain to serve as the dev site. For details, refer to How to add secondary domains with SiteWorx.
- Using SSH, FileZilla, or a similar file-transfer program, copy your website files from your WordPress installation to your new secondary domain. SSH is the preferred method, as FTP may take considerable time to copy these files. See How to set up FileZilla and How to use FileZilla for more information.
- Download your live website’s database as a .sql file to your computer. If you are proficient with the command line interface and MySQL, see How to export tables and import MySQL tables via CLI/SSH. If not, use the method provided in How to import and export MySQL databases in SiteWorx.
- Create a new MySQL database, a new user, and to assign that new user to the new database. Refer to How to create MySQL databases and users with SiteWorx for more information.
- Open this new database in PHPMyAdmin, then import the downloaded .sql file to the dev site database. As in Step 3, see How to export tables and import MySQL tables via CLI/SSH or How to import and export MySQL databases in SiteWorx for guidance.
- Change the base URL by opening your newly imported database in PhpMyAdmin, or access via CLI. In the wp_options table, update the siteurl and home entries with the URL of your dev site. See How to change WordPress URLs for more information.
- Using a text editor, modify your wp-config.php file to reflect the new database name, mysql user, and password you made in Step 4. Save changes on the files you copied to your new dev site. For more information, see the official WordPress documentation about editing your wp-config.php file.
- If you are a Nexcess client, your service includes the WordPress command line (wp-cli), which allows you to easily change all instances of your old domain name in the database. To do so, issue the below commands, but replace the angled brackets (<>) and everything between them with the indicated information. If you are not a Nexcess client, refer to official WordPress documentation for another way to change your old domain name.
- Preview the changes:
wp search-replace <oldomain.com> <newdomain.com> --dry-run
- Search and replace:
wp search-replace <oldomain.com> <newdomain.com>
- Preview the changes:
- If using a WordPress module that enables caching, flush you cache. Refer to the documentation for that module if necessary.