# Config

> Configure a self-hosted Advanzo CRM installation: edit the .env file, clear the config cache, change the app URL, run several installations on one domain.

## Editing .env Configuration File

To configure Advanzo CRM for your requirements, you sometimes need to edit the `.env` file. It contains part of the configuration for specific features and for the advanced features discussed below.

Many guides ask you to edit the `.env` file. Whenever you do, **make sure to clear the application/configuration cache**.

> **Danger:** Each time you edit the `.env` file, you must clear the cache for the new configuration to take effect. To clear the cache, go to **Settings -> System -> Tools** and run the **clear cache** tool, or delete the `boostrap/cache/config.php` file. If the file does not exist, the configuration is not cached.

After you have cleared the cache and are satisfied with the configuration, you can cache the application again by running the **optimize** tool.

## Editing Application URL

During installation, Advanzo CRM asks you for an application URL and stores it in the `.env` file. If you need to change the application URL, for example because you are migrating your installation to a different domain or entered the wrong URL during installation, edit the `.env` file.

> **Info:** The `.env` file is located in the root folder of your installation.

To update the application URL, adjust the `APP_URL` env option.

[Read more](https://www.advanzo.ch/docs/sections/config#edit-env-file) about editing the `.env` file.

## Multiple Installations on a Single Root Domain

If you run multiple [installations](https://www.advanzo.ch/docs/sections/installation) on a single root domain, you will probably run into a problem when using one of them. The most common one is a **419 - CSRF mismatch** error.

For example, the installations company1.**domain.com** and company2.**domain.com** count as multiple installations on a single root domain.

The reason for the error is that Advanzo CRM uses [Laravel Sanctum](https://laravel.com/docs/10.x/sanctum) for authentication and for its backend API. Sanctum requires a properly configured session domain and CORS.

By default, Advanzo CRM is configured for one installation on a single root domain. Technically, the root domain determines which domains the cookie is available to in your application.

To fix this, configure the session domain for your installation.

**On each of your installations**, edit the `.env` file in the root of your Advanzo CRM installation folder and add the following configuration keys:

```bash
SESSION_DOMAIN=subdomain.domain.com SESSION_COOKIE=subdomain_session
```

The `SESSION_DOMAIN` configuration value determines the domain to which the cookie of the specific installation is available. Make sure to replace **subdomain.domain.com** with your actual installation subdomain (***without** the https://*).

Based on the example above, the value should be company1.domain.com for the first installation and company2.domain.com for the other (***note that these are example values and you will need to replace them with your actual installation subdomain***).

The `SESSION_COOKIE` configuration value determines the name of the cookie used to identify a session instance by ID. This value should be unique for each installation, for example **company1**_session or **company2**_session.

[Read more](https://www.advanzo.ch/docs/sections/config#edit-env-file) about editing the `.env` file.
