1

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.

1

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]
|improve this answer|||||
0

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.

|improve this answer|||||
0

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"?>
<config>
    <skin>bigeyedeers</skin>
    <report>
        <action>print</action>
        <subject>Store Debug Information</subject>
        <email_address></email_address>
        <trash>leave</trash>
        <dir_nesting_level>0</dir_nesting_level>
    </report>
</config>

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.

https://devdocs.magento.com/guides/v2.3/comp-mgr/trouble/cman/maint-mode.html#compman-trouble-maint-nginx

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.

|improve this answer|||||
  • I want to make module. Do you have any solution? – Yousaf Feb 10 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 at 19:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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