{"id":7338,"date":"2020-03-30T12:24:09","date_gmt":"2020-03-30T12:24:09","guid":{"rendered":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/?p=7338"},"modified":"2023-02-06T07:00:49","modified_gmt":"2023-02-06T07:00:49","slug":"magento-maintenance-mode","status":"publish","type":"post","link":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/magento-maintenance-mode\/","title":{"rendered":"Learn to Enable and Disable Magento Maintenance Mode"},"content":{"rendered":"<p>Maintenance mode is not only an important but useful mode in Magento. This mode is enabled in case you want to disable your website temporarily prior to making it live or performing maintenance tasks such as bug fixing, updating, etc. When your website is in maintenance mode, store visitors receive a Service Temporarily Unavailable message in their web browser rather than the frontend store. But you can access it from authorized IP addresses for checking the store normally.<\/p>\n<h3>Steps to Enable and Disable Maintenance Mode in Magento 1<\/h3>\n<p>1. Login to your Magento administrator account using SSH.<\/p>\n<p>2. Switch to the directory where Magento is installed. For instance, if you installed Magento in the document root directory, type the below command:<\/p>\n<pre class=\"lang:default decode:true\">cd ~\/public_html<\/pre>\n<p>3. Using your preferred text editor, open the index.php file.<\/p>\n<p>4. Paste the below line in the index.php file:<\/p>\n<pre class=\"lang:default decode:true\">$maintenanceFile = 'maintenance.flag';<\/pre>\n<p>5. Add the below two lines after this. Where xxx.xxx.xxx.xxx is the IP address for which you want to enable the access to the front-end store while Magento is in maintenance mode.<\/p>\n<pre class=\"lang:default decode:true\">$ip = $_SERVER['REMOTE_ADDR'];\n$allowed = array('xxx.xxx.xxx.xxx');<\/pre>\n<div class=\"kb-wisdom-wrapr kb-wisdom-info\">\n<div class=\"kb-wisdom-col kb-wisdom-col-icon kb-wisdom-wrapr-blue\">\n<div class=\"kb-wisdom-icon\">\n<div><\/div>\n<\/div>\n<\/div>\n<div class=\"kb-wisdom-col kb-wisdom-col-content\">\n<p><strong>Note:<\/strong> To discover multiple IP addresses from the maintenance model, separate them with a comma.<\/p>\n<\/div>\n<\/div>\n<p><strong>For example:<\/strong><\/p>\n<pre class=\"lang:default decode:true\">$allowed = array('10.1.0.127','10.1.0.252');<\/pre>\n<p>6. For knowing your own IP address, access the website: http:\/\/ipfinder.us\/<\/p>\n<p>7. Add the below line in the index.php file:<\/p>\n<pre class=\"lang:default decode:true\">if (file_exists($maintenanceFile)) {<\/pre>\n<p>8. Change the line in the following way:<\/p>\n<pre class=\"lang:default decode:true\">if (file_exists($maintenanceFile) &amp;&amp; !in_array($ip, $allowed)) {<\/pre>\n<p>9. Save your changes to the index.php file and close the editor.<\/p>\n<p>10.On the command prompt enter the below command:<\/p>\n<pre class=\"lang:default decode:true \">touch maintenance.flag<\/pre>\n<p>Once you complete with the above steps, your status is set to maintenance mode. After accessing the Magento website from an authorized IP address, the store will display normally. But when your visitors browse the website, they will get a Service Temporarily Unavailable message displayed.<\/p>\n<p>For disabling the maintenance mode and allowing the access of the frontend store to all visitors, type the following command:<\/p>\n<pre class=\"lang:default decode:true\">rm maintenance.flag<\/pre>\n<h3>Steps to Enable or Disable Maintenance Mode in Magento 2<\/h3>\n<p>Magento detects the maintenance mode in the below way:<\/p>\n<ul>\n<li>If var\/.maintenance.flag is not available, the maintenance mode is off and Magento website runs normally.<\/li>\n<li>If var\/.maintenance.flag is present, the maintenance mode is on.<\/li>\n<\/ul>\n<p>But, the maintenance status is also based on the file var\/.maintenance.ip. There will some exceptions made by this file to turn off the Magento 2 maintenance mode even if var\/.maintenance.flag is present.<\/p>\n<p>1. Login to your account using SSH.<\/p>\n<p>2. Go to the file where your Magento is installed in.<\/p>\n<p>3. Add the below command to the command prompt of SSH:<\/p>\n<pre class=\"lang:default decode:true \">php bin\/magento maintenance:enable [--ip=&lt;ip address&gt;]<\/pre>\n<p><strong>For example<\/strong><\/p>\n<pre class=\"lang:default decode:true \">php bin\/magento maintenance:enable --ip=192.168.1.10 --ip=192.168.1.11<\/pre>\n<p>4. With the use of the above command, you will enable the maintenance mode for two IP addresses 192.168.1.10 and 192.168.1.11. The developer\u2019s IP address who wants to debug your website is usually included in the above command.<\/p>\n<p>5. To disable the maintenance mode use the below command:<\/p>\n<pre class=\"lang:default decode:true \">php bin\/magento maintenance:disable [--ip=&lt;ip address&gt;]<\/pre>\n<p>6. To check the current status of the maintenance mode, use the below command:<\/p>\n<pre class=\"lang:default decode:true\">php bin\/magento maintenance:status<\/pre>\n<h3>Steps to Exempt IP Addresses From Maintainance Mode<\/h3>\n<p>For enabling the access to the frontend store from a specific IP address when you put Magento website in maintenance mode, type the below command:<\/p>\n<pre class=\"lang:default decode:true \">php bin\/magento maintenance:allow-ips &lt;ip address&gt; .. &lt;ip address&gt; [--none]<\/pre>\n<p><strong>For example:<\/strong><\/p>\n<pre class=\"lang:default decode:true \">php bin\/magento maintenance:allow-ips 192.168.1.10 192.168.1.11<\/pre>\n<h3>Conclusion<\/h3>\n<p>The above are the short and simple processes to enable\/disable maintenance mode in Magento 2. This guide will help you to manage the maintenance mode in Magento easily.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Maintenance mode is not only an important but useful mode in Magento. This mode is enabled in case you want to disable your website temporarily prior to making it live or performing maintenance tasks such as bug fixing, updating, etc. When your website is in maintenance mode, store visitors receive a Service Temporarily Unavailable message [&hellip;]<\/p>\n","protected":false},"author":16,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[128],"tags":[207,204,1354,1353,1355,410],"class_list":["post-7338","post","type-post","status-publish","format-standard","placeholder-for-hentry","category-cms-faq","tag-cms","tag-magento","tag-magento-maintenance","tag-magento-maintenance-mode","tag-magento-store-maintenance","tag-magento-website"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v25.2 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Learn to Enable and Disable Magento Maintenance Mode<\/title>\n<meta name=\"description\" content=\"Magento&#039;s maintenance mode is not only important, but also useful. Learn to do Magento Maintenance Mode Enabled and Disabled.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/magento-maintenance-mode\/\" \/>\n<meta property=\"og:locale\" content=\"en_GB\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Learn to Enable and Disable Magento Maintenance Mode\" \/>\n<meta property=\"og:description\" content=\"Magento&#039;s maintenance mode is not only important, but also useful. Learn to do Magento Maintenance Mode Enabled and Disabled.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/magento-maintenance-mode\/\" \/>\n<meta property=\"og:site_name\" content=\"Web Hosting FAQs by MilesWeb\" \/>\n<meta property=\"article:published_time\" content=\"2020-03-30T12:24:09+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-02-06T07:00:49+00:00\" \/>\n<meta name=\"author\" content=\"Pallavi Godse\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Pallavi Godse\" \/>\n\t<meta name=\"twitter:label2\" content=\"Estimated reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/magento-maintenance-mode\/\",\"url\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/magento-maintenance-mode\/\",\"name\":\"Learn to Enable and Disable Magento Maintenance Mode\",\"isPartOf\":{\"@id\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/#website\"},\"datePublished\":\"2020-03-30T12:24:09+00:00\",\"dateModified\":\"2023-02-06T07:00:49+00:00\",\"author\":{\"@id\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/#\/schema\/person\/7e3952607fa9eb4e82fea9f7cad9c945\"},\"description\":\"Magento's maintenance mode is not only important, but also useful. Learn to do Magento Maintenance Mode Enabled and Disabled.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/magento-maintenance-mode\/#breadcrumb\"},\"inLanguage\":\"en-GB\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/magento-maintenance-mode\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/magento-maintenance-mode\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Learn to Enable and Disable Magento Maintenance Mode\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/#website\",\"url\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/\",\"name\":\"Web Hosting FAQs by MilesWeb\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-GB\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/#\/schema\/person\/7e3952607fa9eb4e82fea9f7cad9c945\",\"name\":\"Pallavi Godse\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-GB\",\"@id\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/eefc9695ea2b2c6e143c9c9919701aaa?s=96&d=blank&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/eefc9695ea2b2c6e143c9c9919701aaa?s=96&d=blank&r=g\",\"caption\":\"Pallavi Godse\"},\"description\":\"Pallavi is a Digital Marketing Executive at MilesWeb and has an experience of over 4 years in content development. She is interested in writing engaging content on business, technology, web hosting and other topics related to information technology.\",\"url\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/author\/pallavi\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Learn to Enable and Disable Magento Maintenance Mode","description":"Magento's maintenance mode is not only important, but also useful. Learn to do Magento Maintenance Mode Enabled and Disabled.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/magento-maintenance-mode\/","og_locale":"en_GB","og_type":"article","og_title":"Learn to Enable and Disable Magento Maintenance Mode","og_description":"Magento's maintenance mode is not only important, but also useful. Learn to do Magento Maintenance Mode Enabled and Disabled.","og_url":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/magento-maintenance-mode\/","og_site_name":"Web Hosting FAQs by MilesWeb","article_published_time":"2020-03-30T12:24:09+00:00","article_modified_time":"2023-02-06T07:00:49+00:00","author":"Pallavi Godse","twitter_misc":{"Written by":"Pallavi Godse","Estimated reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/magento-maintenance-mode\/","url":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/magento-maintenance-mode\/","name":"Learn to Enable and Disable Magento Maintenance Mode","isPartOf":{"@id":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/#website"},"datePublished":"2020-03-30T12:24:09+00:00","dateModified":"2023-02-06T07:00:49+00:00","author":{"@id":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/#\/schema\/person\/7e3952607fa9eb4e82fea9f7cad9c945"},"description":"Magento's maintenance mode is not only important, but also useful. Learn to do Magento Maintenance Mode Enabled and Disabled.","breadcrumb":{"@id":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/magento-maintenance-mode\/#breadcrumb"},"inLanguage":"en-GB","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.milesweb.co.uk\/hosting-faqs\/magento-maintenance-mode\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/magento-maintenance-mode\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/"},{"@type":"ListItem","position":2,"name":"Learn to Enable and Disable Magento Maintenance Mode"}]},{"@type":"WebSite","@id":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/#website","url":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/","name":"Web Hosting FAQs by MilesWeb","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-GB"},{"@type":"Person","@id":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/#\/schema\/person\/7e3952607fa9eb4e82fea9f7cad9c945","name":"Pallavi Godse","image":{"@type":"ImageObject","inLanguage":"en-GB","@id":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/eefc9695ea2b2c6e143c9c9919701aaa?s=96&d=blank&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/eefc9695ea2b2c6e143c9c9919701aaa?s=96&d=blank&r=g","caption":"Pallavi Godse"},"description":"Pallavi is a Digital Marketing Executive at MilesWeb and has an experience of over 4 years in content development. She is interested in writing engaging content on business, technology, web hosting and other topics related to information technology.","url":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/author\/pallavi\/"}]}},"views":494,"_links":{"self":[{"href":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-json\/wp\/v2\/posts\/7338","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-json\/wp\/v2\/users\/16"}],"replies":[{"embeddable":true,"href":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-json\/wp\/v2\/comments?post=7338"}],"version-history":[{"count":2,"href":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-json\/wp\/v2\/posts\/7338\/revisions"}],"predecessor-version":[{"id":14679,"href":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-json\/wp\/v2\/posts\/7338\/revisions\/14679"}],"wp:attachment":[{"href":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-json\/wp\/v2\/media?parent=7338"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-json\/wp\/v2\/categories?post=7338"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-json\/wp\/v2\/tags?post=7338"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}