Config files multi-environment setup

I’d like to have two config files.

  1. The default config.php containing my standard settings and debug true.

  2. A config file just for use on the live site with

  • avif images (my local server doesn’t support avif images)
  • debug false
  • ‘url’ set

I’ve named the two files:
config.php
config.example.co.uk.php

But on the live site debug is still set to true

I’m trying to following the info here

But don’t understand what this means

Note that the settings in the standard config.php file are always used. If you need different settings in another environment, you will have to override those settings in the domain specific configuration file (or only set those options in your domain specific config file).

Does this mean I can override the config.php settings with my domain specific config file? If so, why is it not working?

My .htaccess file adds ‘www’. I’ve just tried the following and it appears to work

config.www.example.co.uk.php

Does this make sense? If my .htaccess file adds ‘www’ I need to include it in the name of my config file?

Actually, it’s probably best to do this the other way round. Have a config.php that works on the production and staging sites. And then a config.localhost.php just for the local development site.