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.
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.
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
The recommended way in Magento 2 is by updating the server config, see the following link for more details.
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.