Skip to content

Magento 2.1 to 2.1.1 upgrade .htaccess overwrite #6419

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
dapdx opened this issue Aug 31, 2016 · 13 comments
Closed

Magento 2.1 to 2.1.1 upgrade .htaccess overwrite #6419

dapdx opened this issue Aug 31, 2016 · 13 comments
Assignees
Labels
Component: Framework/Setup USE ONLY for FRAMEWORK RELATED BUG! E.g If bug occurs during Catalog Setup use just Catalog Component: Setup Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Priority: P4 No current plan to fix. Fixing can be deferred as a logical part of more important work. Progress: done Reproduced on 2.1.x The issue has been reproduced on latest 2.1 release Reproduced on 2.2.x The issue has been reproduced on latest 2.2 release Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release Severity: S2 Major restrictions or short-term circumventions are required until a fix is available. Severity: S4 Affects aesthetics, professional look and feel, “quality” or “usability”.

Comments

@dapdx
Copy link

dapdx commented Aug 31, 2016

Just wanted to point out that when using the admin to upgrade to 2.1.1 from 2.1 your .htaccess file gets overwritten. Since we use multiple store fronts our domain magrun commands were deleted so our storefronts weren't working. Not sure what other stuff people might have in their .htaccess, but just a warning.

Preconditions

Magento 2.1 upgraeing to 2.1.1 via admin panel
PHP 7
Updated(09/27/2019): Still actual in further upgrading from 2.1.1 directly to 2.3.2.

Steps to reproduce

Used admin panel to upgrade to new version

Expected result

Upgrade to new version correctly (which so far all other elements do)

Actual result

.htaccess file was overwritten causing domains for multistores to not link correctly.

@veloraven
Copy link
Contributor

Closed as duplicate.

Additionally Feature Requests and Improvements should now be submitted to the new Magento 2 Feature Requests and Improvements forum (see details here).

One of corresponding issues was already moved to forum. You can find it here.

@udovicic
Copy link
Member

udovicic commented Apr 6, 2017

Since this task is the only one in series that I have found to be still open, I would like to point out that this does not only affect .htaccess. It affects all files that are placed there by magento-base module when doing composer install. So anything outlined there will be overridden in your code. And in any future case where new thing is added to that module and has the same naming as my code can potentially remove if from my site.

@magento-engcom-team magento-engcom-team added bug report Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed labels Sep 11, 2017
@magento-engcom-team magento-engcom-team added Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed 2.1.x Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Reproduced on 2.1.x The issue has been reproduced on latest 2.1 release Reproduced on 2.2.x The issue has been reproduced on latest 2.2 release labels Oct 24, 2017
@magento-engcom-team
Copy link
Contributor

@dapdx, thank you for your report.
We've created internal ticket(s) MAGETWO-82686 to track progress on the issue.

@czettnersandor
Copy link

I found this ticket because I was looking for why composer install is overwriting my changes during deployment. It's not only updating the .htaccess file but dev/tools/grunt/configs/themes.js.

Since it's essential to add themes to this file to compile .less files and there's no other way to achieve the same, I think this "feature" needs rethinking.

Maybe don't do this overwrite on composer update as these files are not part of the /vendor folder, but do this outside of update, you can create a grunt task or composer script the developers can run, inspect changes in diff, then commit to their project repository.

@wpalmer
Copy link
Contributor

wpalmer commented Jan 10, 2018

In either case, surely any file which is managed via composer install should be added to .gitignore?

@TomashKhamlai TomashKhamlai self-assigned this Dec 11, 2018
@magento-engcom-team
Copy link
Contributor

magento-engcom-team commented Dec 11, 2018

Hi @TomashKhamlai. Thank you for working on this issue.
Looks like this issue is already verified and confirmed. But if your want to validate it one more time, please, go though the following instruction:

  • 1. Add/Edit Component: XXXXX label(s) to the ticket, indicating the components it may be related to.

  • 2. Verify that the issue is reproducible on 2.3-develop branch

    Details- Add the comment @magento-engcom-team give me 2.3-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.3-develop branch, please, add the label Reproduced on 2.3.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!

  • 3. Verify that the issue is reproducible on 2.2-develop branch.

    Details- Add the comment @magento-engcom-team give me 2.2-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.2-develop branch, please add the label Reproduced on 2.2.x

  • 4. If the issue is not relevant or is not reproducible any more, feel free to close it.

@TomashKhamlai TomashKhamlai added Component: Setup Component: Framework/Setup USE ONLY for FRAMEWORK RELATED BUG! E.g If bug occurs during Catalog Setup use just Catalog and removed bug report labels Dec 11, 2018
@TomashKhamlai
Copy link
Contributor

Keeping in mind that the script https://devdocs.magento.com/guides/v2.3/comp-mgr/cli/cli-upgrade.html#upgrade-cli-script is for upgrading to 2.3.0, I will add reproduced on 2.3-develop, because release line 2.3.x is the reason for creating this script

@TomashKhamlai TomashKhamlai added Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed and removed Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development labels Dec 11, 2018
@magento-engcom-team magento-engcom-team added the Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development label Dec 11, 2018
@magento-engcom-team
Copy link
Contributor

@TomashKhamlai Thank you for verifying the issue. Based on the provided information internal tickets MAGETWO-97063, MAGETWO-97064 were created

@TomashKhamlai TomashKhamlai removed their assignment Dec 12, 2018
@ghost ghost removed Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development labels Oct 20, 2020
@ihor-sviziev ihor-sviziev added the Severity: S2 Major restrictions or short-term circumventions are required until a fix is available. label Oct 21, 2020
@ihor-sviziev
Copy link
Contributor

Seems like the only one possible solution will be switching to nginx + php-fpm, that's basically fixes all the issues as all configuration is NOT in the magento2 directory.

@hostep
Copy link
Contributor

hostep commented Oct 21, 2020

I actually think it's a great feature and this probably isn't a bug.
If you put your .htaccess file in git (which you probably should), you should notice it when a magento upgrade overwrites it on your local machine. When that happens, you can decide how to merge your own custom changes with the new changes from Magento. I'm considering this a good thing, because the changes from Magento in that file can be important.
Whereas if you use nginx, you probably won't notice the change in the nginx.conf.sample file and might run into issues if you aren't paying close attention when that file changes...

Anyway, in our deploy flow, we do something like the following, this way the .htaccess file on the server is always in the state as it is in git:

composer install ...
git checkout pub/.htaccess

@magento-engcom-team magento-engcom-team added Priority: P4 No current plan to fix. Fixing can be deferred as a logical part of more important work. Severity: S4 Affects aesthetics, professional look and feel, “quality” or “usability”. labels Nov 30, 2020
@ihor-sviziev ihor-sviziev self-assigned this Feb 4, 2021
@m2-assistant
Copy link

m2-assistant bot commented Feb 4, 2021

Hi @ihor-sviziev. Thank you for working on this issue.
Looks like this issue is already verified and confirmed. But if you want to validate it one more time, please, go though the following instruction:

    1. Add/Edit Component: XXXXX label(s) to the ticket, indicating the components it may be related to.
    1. Verify that the issue is reproducible on 2.4-develop branch
      Details- Add the comment @magento give me 2.4-develop instance to deploy test instance on Magento infrastructure.
      - If the issue is reproducible on 2.4-develop branch, please, add the label Reproduced on 2.4.x.
      - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!
    1. If the issue is not relevant or is not reproducible any more, feel free to close it.

@ihor-sviziev
Copy link
Contributor

Hi,

I re-analyzed this issue again and saw that fixing this issue will not be easy, while it is too low a priority.
It's better to close this issue and for those who are getting it - use one of the options listed below.

Workarounds:

  1. add one more command after the composer install to your deployment process, like this:
composer install ...
git checkout pub/.htaccess
  1. switch from apache to Nginx + php-fpm (to be honest, this is a way better option as, in general, Magento will work a bit faster).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Framework/Setup USE ONLY for FRAMEWORK RELATED BUG! E.g If bug occurs during Catalog Setup use just Catalog Component: Setup Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Priority: P4 No current plan to fix. Fixing can be deferred as a logical part of more important work. Progress: done Reproduced on 2.1.x The issue has been reproduced on latest 2.1 release Reproduced on 2.2.x The issue has been reproduced on latest 2.2 release Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release Severity: S2 Major restrictions or short-term circumventions are required until a fix is available. Severity: S4 Affects aesthetics, professional look and feel, “quality” or “usability”.
Projects
Development

No branches or pull requests