Showing results for 
Search instead for 
Did you mean: 

Unable to modify .htaccess in static directory

0 Kudos

Unable to modify .htaccess in static directory

Feature request from ihor-sviziev, posted on GitHub Aug 23, 2016

I have CORS requests issue with fonts when I using CDN. In order to fix it I'm changing my .htaccess. During deployment I do composer install. After that my changes were reverted.


  1. Magento 2.1.0 installed via composer
  2. Base Static URL is CDN domain (CloudFront in my case)

Steps to reproduce

  1. Install Magento 2 via composer
  2. Change your file pub/static/.htaccess (as example add Header set Access-Control-Allow-Origin "*")
  3. Remove vendor directory
  4. Do composer install

Expected result

My pub/static/.htaccess file should not be overridden.

Actual result

My pub/static/.htaccess file is overridden and my changes were reverted.

Possible solutions:

  • Do not add this file to map listing in composer.json of magento2-base package, move it to magento/product-community-edition package
  • Add ability to override htaccess
New Member

Comment from hostep, posted on GitHub Aug 23, 2016

I don't know if there is a good solution for this, but here are some related issues:

This comment is a possible solution, but Magento will need to change some things before that can happen probably.

Core Contributor

Email me when someone replies

Senior Member