I have a custom 503 "site down for maintenance" page configured and I see this served publicly when I switch to maintenance mode as described here:


I have run the command magento maintenance:enable --ip=<ip address>, which serves to create the var/.maintenance.flag file containing my office ip address in the whitelist. I thus have M2 running in maintenance mode and I still have full access to the site.

But wait! I now wish to do some work on the site in developer mode, i.e. make code changes in xml and php files. When I switch to developer mode, this disturbs the way maintenance mode works, as it prevents the custom 503 status page from showing and instead renders a stack trace to the public! This issue is raised here, but there are no real answers to this conundrum.

What on earth is the point in having a maintenance mode that does not allow a developer to switch into "developer mode" where the caches are bypassed and we can actually do some work?! This whole setup makes no sense to me. If I leave it in production mode, I will need to manually nuke caches/static files after every change is made, which is massively impractical!

What are people doing to work on live Magento 2 sites? What is the workflow adopted to temporarily switch a live site into maintenance mode and run it in developer mode concurrently? The official Magento 2 docs seem to make no attempt to address this. Can anyone point me in the direction of some resources that explain how to put a live site into maintenance mode, then set to developer mode while still showing custom 503 page to the public?

Note: I have custom modules and theme modules that only permit changes to be made via the admin panel when the site is switched to developer mode, so I MUST be able to go into developer mode. Many thanks.

  • did you find a solution ? same pb I need to put the store in developer mode and enable maintenance to prevent public access AND display custom 503 !
    – cap340
    Commented May 28, 2021 at 20:50

1 Answer 1


You need to create an empty .maintenance.flag file and upload it under var/ directory.

So site will automatically goes in maintenance mode.

Refer : http://devdocs.magento.com/guides/v2.2/install-gde/install/cli/install-cli-subcommands-maint.html#instgde-cli-maint

  • This does not answer my question. I know how to switch into maintenance mode as I mentioned. I have run the command magento maintenance:enable --ip=<ip address>, which serves to create the maintenance flag file with my ip address in the whitelist. The question I have refers to running Magento 2 in maintenance mode and in developer mode concurrently
    – ajmedway
    Commented Nov 21, 2017 at 10:35

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.