Taking your store offline and online

Taking your store offline

To temporarily take your store offline, create a simple  html  file called “maintenance.html” (your maintenance notice) in your main Magento folder. Next, copy and paste the following lines to the top of your .htaccess file: 

Order deny,allow Deny from all Allow from 127.0.0.1 <FilesMatch (maintenance\.html)buffer_0gt; Order allow,deny Allow from all </FilesMatch> ErrorDocument 403 /maintenance.html

Adjust the IP address (shown above as 127.0.0.1) to your own. You can check the IP address that you are currently using with  this Google search

Further down in the same .htaccess file, change 

############################################ ## By default allow all access  Order allow,deny  Allow from all

to 

############################################  ## By default allow all access  #Order allow,deny  #Allow from all

This will redirect everyone except yourself (using your specified IP address) to the maintenance.html file. 

Note: These instructions assume that you have a standard  webserver  setup. If your  webserver  serves pages directly to the visitor and doesn’t sit behind another server (eg. Varnish), this could change the IP address a request appears to be coming from and the above code won’t work. It also assumes that your store complies with Magento’s system requirement “Ability to override options in .htaccess files”. 

From Magento version 1.4 onwards, you can place your store into maintenance mode by creating an empty file called “maintenance.flag” in your Magento root folder. Visitors to the site will be greeted by a “service temporarily unavailable” notice. Unfortunately, the maintenance flag also makes the site (including the backend) unavailable to you, so we don’t recommend this option.

Getting your store back online

Delete the following lines from the top of your .htaccess file (where 127.0.0.1 is your own IP address): 

Order deny,allow Deny from all Allow from 127.0.0.1 <FilesMatch (maintenance\.html){replace3}gt; Order allow,deny Allow from all </FilesMatch> ErrorDocument 403 /maintenance.html

Further down in the same .htaccess file, change 

############################################  ## By default allow all access   #Order allow,deny   #Allow from all
to
############################################  ## By default allow all access  Order allow,deny   Allow from all

Your store will now be back online.

Still need help? Contact Us Contact Us