Skip to main content

Avoid overrriding .htaccess on composer update

For drupal 8, take a look into composer.json and checkout for 'extra' section. Add the file_mapping:

        "drupal-scaffold": {
            "locations": {
                "web-root": "web/"
        "file-mapping": {
        "[web-root]/.htaccess": false

I found the solution in the README file for drupal-composer-scaffold: /vendor/drupal/core-composer-scaffold/

There it is to be found when you installed drupal with the composer project drupal/recommended-project


Do not miss security updates in .htaccess file: watch the diff in core/assets/scaffold/files/htaccess