---
title: "Clone an environment"
url: https://docs.corefinity.com/guides/sites/environments-and-copies/clone-a-site
type: guide
last_updated: 2026-11-13
feature: copies
related:
  - https://docs.corefinity.com/api/reference/environments/get-queued-copy.md
  - https://docs.corefinity.com/api/reference/environments/cancel-queued-copy.md
  - https://docs.corefinity.com/api/reference/environments/clone-site.md
  - https://docs.corefinity.com/api/reference/environments/preview-site-clone.md
  - https://docs.corefinity.com/mcp/tools/corestack_site_clone_preview.md
  - https://docs.corefinity.com/mcp/tools/corestack_site_clone.md
  - https://docs.corefinity.com/mcp/tools/corestack_queued_copy_cancel.md
---
# Clone an environment

Copy one environment's files, database or both onto another environment of the same site.

## Before you start

- You can open the site in **Managed Websites**. Anyone who can open a site can clone its environments.
- The copy goes onto an environment of the same site: an existing one, whose contents are replaced, or a new one.
- To replace Production with a staging environment, choose **Production (push to live)** as the target, then **Continue to push to live**. The next step shows what changes and asks you to type the site's domain.

## Clone onto another environment

1. **Open the Clone dialog**

   Go to **Managed Websites**, choose the site, then **Environments** under **Code & backups**. Choose **Clone…**.

   _Screenshot: The Environments section with the Clone… button ringed, beside Create environment._

2. **Choose the source and the target**

   Under **From**, choose the environment to copy. Under **Target**, choose **An existing environment** and pick it, or **A new environment** to go on in the [Create environment](/guides/sites/environments-and-copies/create-an-environment) dialog.

3. **Choose what to copy**

   | What to copy           | Result on the target                                 |
   | ---------------------- | ---------------------------------------------------- |
   | **Files and database** | Everything on the disk and the database is replaced. |
   | **Database only**      | Its files stay as they are.                          |
   | **Files only**         | It keeps its database.                               |

   A target that deploys from Git keeps its code and configuration. **Files and database** then replaces its database and shared folders, such as uploads, and **Files only** its shared folders alone.

   _Screenshot: The Clone Production to Staging dialog: Production as the source, Staging as the target, the choices Files and database, Database only and Files only, the safety snapshot tick, what happens on Staging, and a box to type Staging to confirm._

4. **Keep the safety backup**

   Leave **Take a safety snapshot of** the target **first** ticked. If the copy fails, the target is restored from it, and it stays in the target's backups as **Before clone**.

5. **Confirm**

   Type the target environment's name, then choose the **Clone to** button.

**Environments** shows the progress until the clone finishes. The target does not answer visitors for a few minutes while the data is copied.

## What changes on the target

- Addresses in the copy are rewritten to the target's hostname.
- On a staging target, outgoing email goes to Mailpit and search engines are told not to index it. Production keeps its scheduled tasks, its email and its own search engine setting.
- A staging target's scheduled tasks are switched off.
- The target's hostname, SSH port and password protection stay as they were.
- On WordPress, a clone that copies the database resets the admin password, shown once when the clone finishes.

## Automate this

**API:** [Copy an environment onto another](https://docs.corefinity.com/api/reference/environments/clone-site.md), scope `write`

```bash
curl -X POST https://manage.corefinity.com/api/corestack/sites/1042/clone \
  -H "Authorization: Bearer $COREFINITY_TOKEN" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{
    "confirm_name": "Staging",
    "preview_token": "cp_Xq7mR2vK9sLp4TzW8nBd",
    "safety_first": true,
    "scope": "files_db",
    "target": {
      "environment_id": 1043,
      "type": "environment"
    }
  }'
```

**MCP:** [`corestack_site_clone`](https://docs.corefinity.com/mcp/tools/corestack_site_clone.md), scope `write`

```json
{
  "name": "corestack_site_clone",
  "arguments": {
    "site_id": 4211,
    "target": {
      "type": "environment",
      "environment_id": 4212
    },
    "scope": "db",
    "confirm_name": "Staging"
  }
}
```

**Control Panel:** Managed Websites › your site › Code & backups › Environments ([https://manage.corefinity.com/go/copies](https://manage.corefinity.com/go/copies))

## Related

&#xA;- [Create an environment](/guides/sites/environments-and-copies/create-an-environment): Add, rename or delete a staging environment.
- [Restore a backup](/guides/sites/backups/restore-a-snapshot): Put an environment back from a backup.
