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?

Buy me a drink 🍺 to keep me motivated to create free content like this!