When a Magento 2 store is in maintenance mode, which you switch on with php bin/magento maintenance:enable before an upgrade or a deployment, visitors get Magento’s built-in “Service Temporarily Unavailable” page. It’s plain and says nothing about your store. You can replace its content with your own message, a way to contact you, and your analytics code.
Edit the file pub/errors/default/503.phtml and put the following code in it:
<?php /** * How to edit and customize code of Magento 2 Maintenance 503 Page * Add analytics if any * Replace <COMPANY NAME> with your Organization Name */ ?> <!doctype html> <title>Site Maintenance</title> <style> body { text-align: center; padding: 150px; } h1 { font-size: 50px; } body { font: 20px Helvetica, sans-serif; color: #333; } article { display: block; text-align: left; width: 650px; margin: 0 auto; } a { color: #dc8100; text-decoration: none; } a:hover { color: #333; text-decoration: none; } </style> <article> <h1>We’ll be back soon!</h1> <div> <p>Sorry for the inconvenience but we’re performing some maintenance at the moment. If you need to you can always <a href="mailto:abcd@COMPANY NAME">contact us</a>, otherwise we’ll be back online shortly!</p> <p>— Team COMPANY NAME</p> </div> </article> What to change The PHP comment at the top is just notes. As it says, you can paste your analytics snippet into the page if you want to see how many visitors arrive during the downtime. The <style> block centres the page with 150px of padding, sets a 50px heading and 20px Helvetica text in dark grey, makes the article a 650px column in the middle, and colours links orange. Change the colours and fonts to match your store. The message is inside <article>. Replace abcd@COMPANY NAME in the mailto: link with your real support email address, and COMPANY NAME with your store’s name. ’ is a curly apostrophe and — is a long dash. How Magento uses this file Magento sends the maintenance page with the HTTP status code 503, which tells search engines the downtime is temporary.
...