I am using composer with Drupal lightning. If I update Drupal via composer, it updates the .htaccess file.
Is there any way to prevent the .htaccess file from being overwritten?
While the accepted answer is correct and this prevent the .htacces file from being overwritten, most updates done to that files are linked to security issues. You should patch the file instead, as described in this answer : https://drupal.stackexchange.com/a/271147/25673
Here's a copy of the answer by Stef Van Looveren
scriptssection of your composer.json file, use the following:
"post-drupal-scaffold-cmd": [ "patch -p0 < patches/htaccess.patch" ]
(this requires "drupal-composer/drupal-scaffold" in your