A composer update of your drupal can override changes to your htaccess file. With this snippet you can patch it correctly.

In the scripts section of your composer.json file, add the following:

"post-drupal-scaffold-cmd": [
  "patch -p0 < patches/htaccess.patch"
]

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

 

 

 

Saved you some valuable time?

 

Donate and get more free time-saving code on this website in the future.