I copied




and cleared cache by this command:

docker-compose run --rm cli bin/magento cache:flush
docker-compose run --rm cli bin/magento index:reindex

But after that, the messages.phtml in the vendor is still loaded.

To confirm the messages.phtml in the vendor is really used, I want to directly modify


but it can not be updated because my editor shows it is forbidden to write.

So, I'm not sure the messages.phtml in the vendor is really loaded.

How can I override or overwrite messages.phtml in a vendor?

The version of Magento is probably 2.4.

1 Answer 1


To override the file


you have to copy it into


Do your modifications in that file and clear the cache. If changes are still not applied though, try clearing the var/view_preprocessed folder: rm -rf var/view_preprocessed/*.

  • 1
    thank you very much! your answer solved my problem.
    – user_
    Dec 23, 2021 at 7:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.