How to patch your htaccess file correctly in composer.json After running composer update my Drupal installation gets updated, but it also changes the content of the .htaccess file each time.

How can I correctly patch it?
In the scripts section of your composer.json file, use the following:

"post-drupal-scaffold-cmd": [
  "patch -p0 &lt; patches/htaccess.patch"
]


(this requires "drupal-composer/drupal-scaffold" in your require section)