How to Set Up a Staging / Development Site
A staging site is a private copy of your website where you can safely test changes before applying them to your live site.
Method 1: Subdomain Staging
- In DirectAdmin, create a subdomain: Subdomains →
staging→ your domain. - This creates
~/domains/staging.yourdomain.com/public_html/. - Copy your live site files to the staging directory via FTP or File Manager.
- Create a new database for staging (MySQL Management → Create New Database).
- Export your live database and import it into the staging database.
- Update
wp-config.php(or your app's config) to point to the staging database. - Search-replace your live domain with the staging domain in the database using WP-CLI or a plugin like Better Search Replace.
Method 2: Using Softaculous Staging
If you installed WordPress via Softaculous:
- Log in to DirectAdmin → Softaculous.
- Click Installations → find your WordPress install.
- Click Clone and set the target as a subdomain.
Password Protecting Your Staging Site
Keep it private using .htaccess basic auth:
AuthType Basic
AuthName "Staging — Private"
AuthUserFile /home/yourusername/.htpasswd-staging
Require valid-user
Create the password file via SSH:
htpasswd -c ~/.htpasswd-staging staginguser
Pushing Changes from Staging to Live
- Test everything on staging first.
- Back up your live site.
- Copy changed files from
staging.yourdomain.com/public_html/topublic_html/. - Export the staging database, import to live, and run any search-replace needed.