Notes to the APP_URL

The APP_URL allows external apps to access the Shopware self-hosted. External apps are, for example, extensions that you have purchased via the Shopware Store. In a self-hosted installation, i.e. the use of Shopware on a server where you are responsible for setting up and configuring your web space yourself, the installed apps use the APP_URL to exchange information with Shopware. 
Such information can be, for example, whether the manufacturer provides app updates and whether these are compatible with the Shopware version you have installed. 
The APP_URL is used for this communication regardless of the registered account / licence domain. If you move your shop to another domain, the licence domain in the admin can differ from the APP_URL. One effect of this is that you will receive a message "Domain change detected" when you log in. In addition, errors can occur when using your apps if the APP_URL is not accessible or refers to a server with outdated information. Therefore, check the specified APP_URL when you move your shop.
The APP URL is a configuration variable that is read from the .env file. The file is always located in the root directory of your Shopware installation. In order to view and edit it, you need access via FTP or SSH. Some hosters have a call for this in their administration console. 

As of Shopware version 6.5.0.0, the described changes should be made in the .env.local file instead of the .env file.

Please note: The .env file is a hidden file. If it is not displayed to you, you must activate the display of hidden files in your tool with which you access the Shopware directory.

You can find out how to do this in the operating instructions for the software you are using or from your hoster.  
The file can be viewed and edited with any text editor. Here is an example of the abbreviated structure of the file:

APP_ENV="prod"
APP_URL="https://YOUR-DOMAIN"
DATABASE_URL="mysql://YOUR-DATABASE"
SHOPWARE_ES_HOSTS="elasticsearch:9200"
SHOPWARE_ES_ENABLED="0"
SHOPWARE_ES_INDEXING_ENABLED="0"
SHOPWARE_ES_INDEX_PREFIX="sw"
SHOPWARE_HTTP_CACHE_ENABLED="1"
SHOPWARE_HTTP_DEFAULT_TTL="7200"

...

The APP_URL is specified here in the second line.

To avoid errors, the following points should be observed:

1. accessibility

Shopware must know under which domain the store can be reached by external services. You store the desired domain during the basic setup. This domain cannot be easily changed later in the administration. By default, the domain that is stored here is the domain of the first sales channel.
You can rudimentarily check whether your domain is accessible after a change by entering the new URL as the address in your browser. If an error occurs when you confirm or the URL is changed during loading, you have not used the correct URL. Some browsers hide by default which protocol is used (http:, https:), usually http: is represented by an open lock. Alternatively, click into the address bar and press the [home] key on your keyboard. This will show you the complete URL.

2. multiple domains

If your store already uses multiple domains in your sales channel, you should use one of them as APP_URL. External systems will then communicate with your store via this domain by default.  
You will find the domains in your sales channels.

3. shop/domain moved

If you move your store to a new domain or if you have created your store within a staging environment with a different domain, you must not forget to adjust the configuration accordingly, otherwise there will be problems. Especially if the store is changed to https afterwards or if configuration files were copied and pasted.
You can check whether the licence domain is entered correctly in Settings > System > Shopware Account. You will find further information on that topic here.

4. environment variable "APP_URL

The environment variable "APP_URL" must be configured so that it points to the domain under which the store can be reached from outside. An .env file in the root directory should start with the line "APP_URL={domain}" (e.g. APP_URL=https://my-shop.com) or can be adjusted accordingly in case of changes. 

5. disable error message "Wrongly configured APP_URL

In production mode of your store, Shopware automatically checks if the configured APP_URL can be reached. If not, a warning message will be displayed.
If the APP_URL is configured correctly, but still does not work, you can do the following:
You can set the variable in the .env to APP_URL_CHECK_DISABLED=1. If there is no such entry, simply copy the pattern mentioned here and save it in the file .env.

This may cause apps to not work. In this case it is necessary that the HTTP communication between the store and the host is allowed.

Was this article helpful?