I want to customize maintenance mode in Magento2.

Magento2 error message will be hide and my custom message will be visible.

If you know anything related to this then share with me.

3 Answers 3


You can Enable Or disable it by using the command line

magento maintenance:enable [--ip=<ip address> ... --ip=<ip address>] | [ip=none]

magento maintenance:disable [--ip=<ip address> ... --ip=<ip address>] | [ip=none]

Create a file call 503.phtml in the directory pub/errors/default

This will then be served to the user everytime there is a 503 error which is maintenance mode.


Old Magento 1 Way

Create a copy of the pub/errors/local.xml.sample file and update the skin name within to something unique. I usually use the current theme name, say bigeyedeers. So the local.xml file should look something like so

<?xml version="1.0"?>
        <subject>Store Debug Information</subject>

Then copy the pub/errors/default folder to what ever skin name you chose in the local.xml

cp -r pub/errors/default pub/errors/bigeyedeers

Now you can update 503.phtml with your custom maintenance page content

Server Config (Magento 2 Recommended Way)

The recommended way in Magento 2 is by updating the server config, see the following link for more details.


Through a Magento Module

I haven't tried using a Magento module to change the maintenance page before and would recommend against it. But the logic that handles detecting maintenance mode and throwing the 503 is within lib/internal/Magento/Framework/App/Bootstrap.php:assertMaintenance(). Overwriting this method and requiring your html file then exiting may work.

  • I want to make module. Do you have any solution?
    – Yousaf
    Feb 10, 2020 at 16:34
  • I haven't tried using a module before, but I've updated my answer to include where you can find the maintenance logic to try overriding.
    – Sam
    Feb 10, 2020 at 19:02

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.