Table of Contents
How to Enable and Disable Maintenance Mode in Magento 2
Have you ever seen a “Work in Progress” sign which is usually put at a construction site? It lets people know that maintenance is happening and they must be cautious. Similarly, in Magento 2, it is possible to enable Maintenance Mode to notify visitors that a store is temporarily unavailable.
What is Maintenance Mode in Magento 2?
Maintenance Mode is a feature in Magento 2 that allows displaying a temporary message to visitors while updates are being performed, new themes are being installed, extensions are being configured, security issues are being fixed, or other important changes are being made. During this time, regular visitors will not be able to access the store and will see a maintenance notification instead. However, developers or authorized users will still have access to the store if their IP addresses are whitelisted.
How to Enable Maintenance Mode in Magento 2
You can easily enable Maintenance Mode in Magento 2 using simple command-line instructions. Below are the steps you can follow.
Enabling Maintenance Mode
To enable Maintenance Mode in Magento 2, run the following command in your terminal in Magento root directory:
php bin/magento maintenance:enableThis will activate Maintenance Mode, and visitors to your store will see a maintenance notification.
Enabling Maintenance Mode for Specific IP Addresses
If you want to allow a specific user (like your developer) to access the store while it is in Maintenance Mode, you can whitelist their IP address. To do this, use the following command:
php bin/magento maintenance:enable --ip=<IP Address>For example, to allow two IP addresses, you can run:
php bin/magento maintenance:enable --ip=192.168.1.10 --ip=192.168.1.20This will allow users with the mentioned IP addresses to still access the website even though it’s in Maintenance mode.
How to Disable Maintenance Mode in Magento 2
Maintenance Mode in Magento 2 can also be easily disabled using simple command-line instructions. Below are the steps you can follow.
Disabling Maintenance Mode
Once you’ve finished the maintenance work and ready to bring your store back online, run this command:
php bin/magento maintenance:disableThis will disable Maintenance Mode and make your store generally accessible again.
Disabling Maintenance Mode for Specific IP Addresses
If you have enabled Maintenance Mode for certain IP addresses, you can disable it for those IPs specifically by using:
php bin/magento maintenance:disable --ip=<IP Address>Checking Maintenance Mode Status
To check the current status of Maintenance Mode (whether it’s enabled or disabled), use the following command:
php bin/magento maintenance:statusThis will show whether Maintenance Mode is activated or not.
Allowing Specific IPs While in Maintenance Mode
If you want to allow certain IP addresses access to the store when it’s already in Maintenance Mode, use this command:
php bin/magento maintenance:allow-ips <IP Address> [<IP Address> ...]For example:
php bin/magento maintenance:allow-ips 192.168.1.10 192.168.1.20This will grant access to users with the specified IP addresses.
If you want to remove all allowed IPs and restrict access completely, use:
php bin/magento maintenance:allow-ips --noneHow to Customize the Maintenance Page in Magento 2
Are you tired of seeing the dull “Service Temporarily Unavailable” message when your Magento 2 store is under maintenance? Do you wish you could make your store’s maintenance page more engaging and informative for your visitors? Below, we will show you how to easily customize the maintenance mode page in Magento 2 and offer some extra tools to make this process even easier!
Why Customize the Maintenance Page?
Just like physical stores, online stores also need regular maintenance, which can include fixing bugs, adding new features, or updating the store’s design. These tasks are crucial for keeping your store running smoothly. However, during maintenance, it is essential to restrict access to your website to avoid frustrating your customers.
By default, Magento 2 displays a generic “Service Temporarily Unavailable” message when your site is in maintenance mode. While it may work fine for store owners and developers, it might be unsuitable for your customers as it doesn’t offer much clarity or a professional experience. That’s where customization comes in!
Customizing the Maintenance Page in Magento 2
There are two ways to customize the maintenance page in Magento 2: programmatically (through code) or with the help of a module like the Magento 2 Store Maintenance extension.
Method 1: Programmatic Solution
To customize the maintenance page manually, you will need to modify the code in the backend of your store. The default maintenance page content is stored in a .phtml file, specifically the 503.phtml file, which is located in the following directory:
/pub/errors/default
- Access the 503.phtml file: Open this file in any text editor or IDE.
- Modify the content: You can replace the existing code with your custom HTML, CSS, or even add some branding elements like logos, images, and personalized messages.
- Save and upload the file: After making the changes, save the file and upload it to the directory mentioned above. This will change how your maintenance page looks.
While this method is simple, it requires a good understanding of web design and coding. If you’re not familiar with HTML, CSS, or PHP, this might not be the best option for you.
Method 2: Using the Magento 2 Maintenance Page Extension
If you’re not comfortable with coding or simply want an easier way to customize your Magento 2 maintenance page, you can use the free Magento 2 Store Maintenance extension from Swiss Up Labs. This extension provides an intuitive and easy-to-use solution for customizing the maintenance page without needing any programming knowledge. It allows displaying an engaging and professional maintenance page with custom content, helping you protect your brand and enhance user experience.
One of the standout features of the extension is the ability to display the expiration date of the maintenance period. This feature not only notifies visitors about the expected end of the maintenance but also reassures them about when they can return to your site. Additionally, the Maintenance Page extension ensures that search engines are informed about the temporary nature of the maintenance mode. It sends a 503 HTTP status code to search engine crawlers, ensuring that your pages aren’t removed from search engine indexes due to inactivity.
Key Features of the Store Maintenance Extension
General Settings
- Enable/Disable Maintenance Mode: Easily toggle your store’s maintenance mode on or off.
- IP Whitelisting: Allow specific IP addresses to access the store during maintenance. You can easily configure a list of allowed IP addresses in the settings.
Response Header
- Inform Search Robots: You can configure the extension to inform search crawlers when your site is back online. This prevents search engines from deleting your content from their databases.
- Specify Maintenance End Date: Set and display the exact date when the maintenance will be completed.
- Set End Time: Easily select the maintenance end time using dropdown menus.
Customizable Maintenance Page
- Content Editor with Syntax Highlighter: Create and edit your maintenance page content easily with a syntax highlighter for clean and readable code.
- Customizable Title and Content: Set a unique title and customize the body of your maintenance page using HTML markup. You can also add custom CSS to style the page.
- Visual Elements: Add your logo, background image, or even videos to the maintenance page for a more professional appearance. You can also adjust text, colors, and more.
- Quick Preview: View a live preview of your maintenance page directly in the admin panel before it goes live.
Additional Advantages
- Compatibility with Custom and Third-Party Magento 2 Themes: The extension is designed to work seamlessly with both custom and third-party Magento 2 themes.
- Responsive Design: The maintenance page is fully responsive, ensuring it looks great on all screen sizes and devices.
The Store Maintenance extension for Magento 2 offers an easy and effective way to keep your customers informed and engaged during scheduled downtime. With customizable options, the ability to display an end date for maintenance, and search engine-friendly features, this extension provides a smooth, professional solution to handling maintenance periods without frustrating your visitors.
Conclusion
Enabling Maintenance Mode in Magento 2 is an easy way to temporarily show a maintenance message while updates or changes are being made to a store. Using simple bin/magento commands, you can enable or disable Maintenance Mode, allow or block specific IP addresses, and check the status of the mode. This makes it possible for developers to continue working on your store behind the scenes while other visitors see a maintenance notification.
Customizing the maintenance page in Magento 2 is essential to maintain a professional look and improve the customer experience. Whether you choose to modify the 503.phtml file manually or use the Magento 2 Maintenance Page extension, you can easily replace the default message with a page that better suits your branding and keeps customers informed.
If you’re looking for an easy and feature-rich solution, the Magento 2 Maintenance Page extension is a great choice. With its user-friendly features like the countdown timer, WYSIWYG editor, subscription box, and social media integration, you can provide your customers with a much better experience while your store undergoes maintenance.