{"id":8619,"date":"2025-02-24T22:00:21","date_gmt":"2025-02-24T16:30:21","guid":{"rendered":"https:\/\/pheonixsolutions.com\/blog\/?p=8619"},"modified":"2026-09-12T09:13:23","modified_gmt":"2026-09-12T03:43:23","slug":"how-to-enable-maintenance-mode-in-magento-2","status":"publish","type":"post","link":"https:\/\/pheonixsolutions.com\/blog\/how-to-enable-maintenance-mode-in-magento-2\/","title":{"rendered":"How to Enable Maintenance Mode in Magento and Customize the Maintenance Page"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">Introduction<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Magento 2 includes a built-in maintenance mode that allows store owners and developers to temporarily restrict public access to their online store during upgrades, security patch installations, extension updates, database migrations, or server maintenance. This helps prevent customers from encountering broken pages, checkout issues, or unexpected errors while critical changes are being made.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">When maintenance mode is enabled, visitors are shown a maintenance page instead of the storefront, ensuring a professional user experience during downtime. Magento 2 also allows specific IP addresses to bypass maintenance mode, enabling administrators and developers to test changes before the site is made live again.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In this guide, you&#8217;ll learn how to enable and disable maintenance mode in Magento 2, whitelist IP addresses, customize the maintenance page, and troubleshoot common maintenance mode issues.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Enabling Maintenance Mode in Magento<\/strong><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Magento 2 provides a built-in maintenance mode that temporarily restricts customer access to your store while updates, deployments, or maintenance activities are being performed. This helps prevent visitors from encountering errors, broken functionality, or incomplete updates.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">To enable maintenance mode, navigate to your Magento 2 root directory and run:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">php bin\/magento maintenance:enable<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Once enabled, visitors will see a <strong>503 Service Unavailable<\/strong> maintenance page instead of the storefront.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Check Maintenance Mode Status<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">To verify whether maintenance mode is active, run:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">php bin\/magento maintenance:status<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Expected output:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">Maintenance mode is active.<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Allowing Specific IPs to Access the Store<\/strong><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">By default, maintenance mode blocks access to all visitors. However, Magento 2 allows you to whitelist specific IP addresses so that developers, administrators, or QA teams can continue accessing the store during maintenance.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Allow a Single IP Address<\/h4>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">php bin\/magento maintenance:allow-ips &lt;your-ip-address><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Example:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">php bin\/magento maintenance:allow-ips 192.168.1.100<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">Allow Multiple IP Addresses<\/h4>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">php bin\/magento maintenance:allow-ips 192.168.1.100 192.168.1.101<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">Verify Allowed IP Addresses<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">Run the following command:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">php bin\/magento maintenance:status<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Example output:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">Maintenance mode is active.\nAllowed IPs: 192.168.1.100, 192.168.1.101<\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">Remove All Allowed IP Addresses<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">To remove all whitelisted IPs and restrict access to everyone, run:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">php bin\/magento maintenance:allow-ips --none<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Customizing the Magento Maintenance Page<\/strong><\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Magento\u2019s default maintenance page is located at:<\/li>\n<\/ul>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>pub\/errors\/default\/503.phtml<\/strong><\/li>\n<\/ul>\n\n\n\n<ul class=\"wp-block-list\">\n<li>To create a custom maintenance page:<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Modify the custom page<\/strong> Open pub\/errors\/503.phtml and update the content with a user-friendly message. Example:<br><br><img fetchpriority=\"high\" decoding=\"async\" width=\"1098\" height=\"704\" class=\"wp-image-8620\" style=\"width: 600px\" src=\"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2025\/02\/Screenshot-2025-02-24-at-9.40.11\u202fPM.png\" alt=\"\" srcset=\"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2025\/02\/Screenshot-2025-02-24-at-9.40.11\u202fPM.png 1098w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2025\/02\/Screenshot-2025-02-24-at-9.40.11\u202fPM-300x192.png 300w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2025\/02\/Screenshot-2025-02-24-at-9.40.11\u202fPM-1024x657.png 1024w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2025\/02\/Screenshot-2025-02-24-at-9.40.11\u202fPM-768x492.png 768w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2025\/02\/Screenshot-2025-02-24-at-9.40.11\u202fPM-468x300.png 468w\" sizes=\"(max-width: 1098px) 100vw, 1098px\" \/><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">After modifying the page, clear Magento\u2019s cache to reflect changes:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>php bin\/magento setup:static-content:deploy -f<\/strong><\/li>\n\n\n\n<li><strong>php bin\/magento cache:flush<\/strong><\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Disabling Maintenance Mode<\/strong><\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Once maintenance is completed, disable it with:<\/li>\n<\/ul>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>php bin\/magento maintenance:disable<\/strong><\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Check the status to confirm:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>php bin\/magento maintenance:status<\/strong><\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">If disabled, the output will be:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Maintenance mode is not active.<\/strong><\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Troubleshooting Maintenance Mode Issues<\/strong><\/h2>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>1. Site Still in Maintenance Mode After Disabling?<\/strong><\/h4>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Check if the var\/.maintenance.flag file still exists. If it does, remove it manually:rm var\/.maintenance.flag<\/strong><\/li>\n<\/ul>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>2. Getting 503 Errors After Maintenance Mode is Disabled?<\/strong><\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">Try clearing cache and restarting your web server:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>php bin\/magento cache:flush<\/strong><\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Conclusion<\/strong><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Magento 2 maintenance mode is an essential feature for safely performing upgrades, security patches, extension installations, server maintenance, and other critical updates. By temporarily restricting public access, you can prevent customers from encountering errors or incomplete functionality during maintenance activities.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Additionally, Magento 2 allows you to whitelist specific IP addresses for testing and customize the maintenance page to provide clear communication and maintain a professional brand experience. Following these best practices helps minimize downtime, improve customer trust, and ensure a smooth update process for your online store.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Frequently Asked Questions (FAQ)<\/h2>\n\n\n\n<h4 class=\"wp-block-heading\">1. How do I enable maintenance mode in Magento 2?<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">You can enable maintenance mode in Magento 2 by running the following command from your Magento root directory:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">php bin\/magento maintenance:enable<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Once enabled, visitors will see a 503 maintenance page while administrators or whitelisted IP addresses can continue accessing the website.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">2. How can I allow my IP address during Magento 2 maintenance mode?<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">Magento 2 allows specific IP addresses to bypass maintenance mode. Use the following command:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">php bin\/magento maintenance:allow-ips YOUR_IP_ADDRESS<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">For example:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">php bin\/magento maintenance:allow-ips 192.168.1.100<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">This is useful for developers, administrators, and QA teams who need access to the store while maintenance is in progress.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">3. Why is my Magento 2 store still showing the maintenance page after disabling maintenance mode?<\/h4>\n\n\n\n<p class=\"wp-block-paragraph\">If the store remains in maintenance mode after running:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">php bin\/magento maintenance:disable<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">check whether the maintenance flag file still exists:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">rm -f var\/.maintenance.flag<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Then clear the Magento cache:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">php bin\/magento cache:flush<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">If the issue persists, restart your web server and review the Magento logs located in <code>var\/log\/system.log<\/code> and <code>var\/log\/exception.log<\/code>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Related Articles<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/pheonixsolutions.com\/blog\/the-magento-based-website-is-not-working-with-https\/\">The Magento Based Website Is Not Working With HTTPS<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/pheonixsolutions.com\/blog\/how-to-resolve-the-autoload-error-while-installing-magento2-in-ubuntu-18-04-20-04\/\">How to Resolve the Autoload Error While Installing Magento2 in Ubuntu 18.04 &amp; 20.04<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/pheonixsolutions.com\/blog\/how-to-update-secure-and-unsecure-urls-directly-in-the-magento-database\/\">How to Update Secure and Unsecure URLs Directly in the Magento Database<\/a><\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Talk to our experts<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Looking for the right technology solution for your business? Our team of experts can help you with development, cloud, DevOps, design, and a wide range of other technology needs. Get in touch with our team&nbsp;<a href=\"https:\/\/pheonixsolutions.com\/contact\" rel=\"noreferrer noopener\" target=\"_blank\">here<\/a>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Introduction Magento 2 includes a built-in maintenance mode that allows store owners and developers to temporarily restrict public access to [&hellip;]<\/p>\n","protected":false},"author":514,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[1022],"tags":[],"class_list":["post-8619","post","type-post","status-publish","format-standard","hentry","category-web-architecture","psol-cat-web-architecture"],"jetpack_publicize_connections":[],"jetpack_shortlink":"https:\/\/wp.me\/phn2x7-2f1","jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/8619","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/users\/514"}],"replies":[{"embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/comments?post=8619"}],"version-history":[{"count":1,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/8619\/revisions"}],"predecessor-version":[{"id":11676,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/8619\/revisions\/11676"}],"wp:attachment":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/media?parent=8619"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/categories?post=8619"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/tags?post=8619"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}