How to setup a test / staging website?

Previous experiencing with cloning / migrating WordPress websites is necessary.
  1. Login to your hosting cPanel and file manager.
  2. Create a “test” folder in “root” directory.
  3. Copy all files from “root” to “test”.
  4. Export main website database from the main website via phpMyAdmin (or some other DB management tool).
  5. Change URL's in database file from to
  6. Create a new database and import the file with changed URL's from the previous step.
  7. Change the database credentials in wp-config.php under “test” folder to connect the test site to a new database.