Issue
My .htaccess file and other core files are being overwritten during Drupal core updates.
Resolution
To prevent the .htaccess file from being overwritten when Drupal core is updated, you can add the following to the extra
section in your composer.json:
- If you are using drupal/core-composer-scaffold
add the following:
"extra": {
"drupal-scaffold": {
"file-mapping": {
"docroot/.htaccess": false
}
}
}
- If you are using drupal-composer/drupal-scaffold
add the following:
"extra": {
"drupal-scaffold": {
"excludes": [
".htaccess",
"robots.txt"
]
}
}