How to create a staging site
There are several ways to create a staging site for testing and development:
1. The hosting may have a feature of creating a staging site. Use this feature if it exists.
2. You may use special plugins like WP STAGING to create a staging site.
3. Follow these steps to create a staging site manually:
- Go to your hosting control panel and use the tool phpMyAdmin or other tool that your hosting provides to manage databases.
- Export the database of the live site to the SQL file.
- Create a new database. Skip this step if you have created a staging site's database before.
- Import data from the SQL file to the staging site's database.
- Go to the staging site's database, open the table wp_options, find and change options siteurl and home. The value must be an URL used for the staging site.
- Use a file manager. You may use a program FileZilla or other tool that your hosting provides to manage files.
- Copy all files from the folder of the live site to the folder of the staging site.
- Open the file wp-config.php and change the database configuration. Change constants DB_NAME, DB_USER, DB_PASSWORD. Set database name, username and password to access the staging site's database.
- Optional. Change the file .htaccess if needed. Change RewriteBase and RewriteRule if your staging site is located in the subdirectory.
Image - Modify values for options siteurl and home
Image - Change the database configuration
Image - Example of the .htaccess file for the staging site in the subdirectory