---
title: "Prevent your .htaccess from being overwritten during Drupal core updates."
date: "2025-02-05T23:31:59+00:00"
summary:
image:
type: "article"
url: "/acquia-cloud-platform/help/94446-prevent-your-htaccess-being-overwritten-during-drupal-core-updates"
id: "564a9353-46ec-49ac-abc5-806b6185df9e"
---

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"
          ]
        }
      }