# Transfer to a New Domain

> Transfer a self-hosted Advanzo CRM installation to a new domain or server without losing data.

This guide shows step by step how to move your Advanzo CRM installation to a different domain. Follow the steps carefully, so that your data is transferred properly and the application works correctly in its new environment.

Advanzo CRM is a Laravel-based application. If you are already familiar with Laravel, you will recognise many of these steps; others are specific to Advanzo CRM.

Before you start the migration:

- Make sure that your new server meets all the requirements for running Advanzo CRM.
- Always create backups before you start the transfer, to avoid any data loss.

## Export Your Database

- Use a database management tool such as phpMyAdmin to export your database.
- Select the right database and choose a suitable export format (e.g., SQL).

## Zip and Transfer Files

- Compress (zip) all the Advanzo CRM files on your current server/location.
- Transfer this .zip file to your new server/location via FTP/SFTP or any other file transfer method.

## Unzip Files

- On the new server/location, unzip the transferred .zip file to extract all the Advanzo CRM files.
- If you included the `public/storage` folder in the .zip file, delete this folder in your new location. It is a symlink, which you re-create in the "Finalise Migration" step below by running the "**storage-link**" tool.

## Import Database

- Import the previously exported database into the new server.
- You can do this with phpMyAdmin or any other database management tool you prefer.

## Update Environment Settings

- Edit the `.env` file in your new location to update the database credentials and URL.
- Make sure that the `DB_HOST`, `DB_DATABASE`, `DB_USERNAME` and `DB_PASSWORD` fields match the details of your new database.
- Make sure that the `APP_URL` matches the URL of your new location.

For more information on editing the .env file, see the [documentation](https://www.advanzo.ch/docs/sections/config#edit-env-file).

## Clear Cache

- In your new location, go to the `bootstrap/cache` directory.
- Delete all the cache files in this directory.
- If the new location is on the same main domain as the old location, clear your browser cache.

## Ensure Proper Domain Document Root

The document root of your new domain must point to the `public` directory. Since you had a working installation before, you probably configured this for your old installation; make sure to do the same for your new domain.

See the [installation guide](https://www.advanzo.ch/docs/sections/installation) for details on how to change the document root of your new subdomain.

## Finalise Migration

- Open your application at the new domain URL and log in as an admin user.
- Make sure that all requirements are met. A warning message at the top of the dashboard contains a link to check the requirements and confirm them.
- After confirming the requirements, go to **Settings -> System -> Tools** and run the "**storage-link**" tool.
- Run the "**optimize**" tool to cache common files.

### Configure Cron Job

- Configure the cron job for your new location. See the [cron job guide](https://www.advanzo.ch/docs/sections/cron) for details.

### Update Related URLs

- If you have configured the Twilio integration, go to **Settings -> Integrations->Twilio** and update the app-related URL.
- Every user who has configured [calendar synchronisation](https://www.advanzo.ch/docs/sections/calendar#calendar-sync) must disconnect and reconnect it, so that the synchronisation webhooks use the new URL.

## Clean Up

- Once you have confirmed that the application works correctly on the new domain, delete the old installation from the old server/location.
- Remove any cron jobs related to the old installation.
