NC 14 seems to require a trailing slash in the specification of overwrite.cli.url in config/config.php
sudo -u www-data php /var/www/nextcloud/occ maintenance:update:htaccess
Without a trailing slash:
Error updating .htaccess file, not enough permissions or "overwrite.cli.url" set to an invalid URL?
With a trailing slash:
.htaccess has been updated
If this is a permanent situation, then these two files need updating: