Configure Preferred Domain
Once you have fully set up the desired domain for your sales channel and configured a suitable SSL certificate, you can set up an automatic 301 redirect for your store domain to the exact URL of the sales channel.
Background
When a sales channel is accessed, Shopware 6 distinguishes between the protocols http:// and https://, as well as whether the domain is accessed via www. or without www.. To avoid duplicate content, you should avoid setting up all four cases in Shopware and instead implement a permanent (301) redirect from the web server.
Configure the Preferred Domain
First, log in to the Plesk Control Panel via our Customer Center and navigate to your shop domain.
Next, in the Hosting and DNS tab, select the Hosting menu item.
Under the Preferred Domain setting, select your desired option. Here: www.creoline-demo.com. After you’ve saved the changes, you can use our free HTTP Redirect Tool to check whether the redirects are working properly.
Customizing the Environment Configuration in Shopware 6
To correctly complete the configuration for Shopware 6, the environment variable APP_URL in the .env.local file must be set or adjusted to the domain you have selected as your preferred one.
The background of the APP_URL is described in more detail in this Shopware article.
To determine the correct and final APP_URL, you can use our redirect tool.
It is important to understand that this must always be the exact URL through which your store is operated.
Example URL: http://creoline-demo.de
APP_URL: https://www.creoline-demo.de
If no redirection occurs during the HTTP redirect test, you have already entered the correct APP_URL. See: Environment Configuration .env.local