Magento Forum

Page 1 of 2
Switch store on/off for maintenance
 
raisinlove
Jr. Member
 
Total Posts:  17
Joined:  2008-06-20
Montreal
 

Hi, I havent found this topic covered in the docs…
How do I switch the store off for maintenance? I just installed my online store and would rather people not see the default front page while I setup the catalog and look and feel with my branding. I tried putting an index.html in the website root, but the Magento index.php still overrides it. If I change the index.php file, I cant admin the store anymore, so that doesnt seem to be an option…

thank you

 
Magento Community Magento Community
Magento Community
Magento Community
 
raisinlove
Jr. Member
 
Total Posts:  17
Joined:  2008-06-20
Montreal
 

My research so far has brought me to the admin/system/configuration/web/ configuration options.
There’s a heading called Default Pages.

By default, the “Default web url” is “cms”

I tried to change this to “index.html” and the full url to that page but neither seem to be working: when I use the base url of my website, the 401 page not found page comes up. The front page is restored if I type in “cms” again.

Getting close but not there yet. Any ideas?

 
Magento Community Magento Community
Magento Community
Magento Community
 
Ron Phillips
Member
 
Total Posts:  57
Joined:  2008-04-16
 

You can probably do this one of two ways.

1. You could create a CMS page that basically has a coming soon message.

2. Create an Index.html file and change your DirectoryIndex to index.html over index.php. I don’t see anything in the mage .htaccess file that forces index.php to be loaded.

HTH

 
Magento Community Magento Community
Magento Community
Magento Community
 
raisinlove
Jr. Member
 
Total Posts:  17
Joined:  2008-06-20
Montreal
 

Thanks Ron, the htaccess solution might have to be my last resort as the other solution seems preferable. The problem that poses however, is that the page will still be contained within the original layout, right? Can I create and assign a specific template to that page within which I could remove the menu and default logo?

 
Magento Community Magento Community
Magento Community
Magento Community
 
Moshe
Magento Team
 
Avatar
Total Posts:  1770
Joined:  2007-08-07
Los Angeles
 

@raisinlove: while you are actively developing your site, the .htaccess solution looks more preferable to me, as index.html will not be affected by your customizations and possible error messages, and you can guarantee that your visitors will see an unaltered “coming soon” page.

 
Magento Community Magento Community
Magento Community
Magento Community
 
raisinlove
Jr. Member
 
Total Posts:  17
Joined:  2008-06-20
Montreal
 

Thanks, I’ll go with the htaccess solution then. This might be a feature to consider or future versions, a simple switch.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Moshe
Magento Team
 
Avatar
Total Posts:  1770
Joined:  2007-08-07
Los Angeles
 

@raisinlove: If you are talking about making magento configuration switch for this, i do not think this will be ever done for the same reason i’ve stated before - during development it is better to show static page, if you do not want occasional visitor see your debug info.

 
Magento Community Magento Community
Magento Community
Magento Community
 
jfbonham
Jr. Member
 
Total Posts:  27
Joined:  2008-01-08
 

Looking to do the same thing.

Could someone please post some example htaccess code for redirecting? The admin panel obviously still needs to be accessible, the trouble I am having is targeting only people who go to the main address, not */admin.

 
Magento Community Magento Community
Magento Community
Magento Community
 
l0st
Member
 
Total Posts:  55
Joined:  2008-04-06
 

http://httpd.apache.org/docs/mod/mod_access.html

 
Magento Community Magento Community
Magento Community
Magento Community
 
Moshe
Magento Team
 
Avatar
Total Posts:  1770
Joined:  2007-08-07
Los Angeles
 

Another option could be to put a code in index.php that will redirect to static index.html if IP is not approved:

<?php
// before anything else put this (replace with your dev IP and a valid static page URL):
if ($_SERVER['REMOTE_ADDR']!=='1.2.3.4'
  header
("Location: /index.html");
  exit;
}
 
Magento Community Magento Community
Magento Community
Magento Community
 
luric
Jr. Member
 
Avatar
Total Posts:  15
Joined:  2008-02-13
 
Moshe - 21 June 2008 12:52 PM

Another option could be to put a code in index.php that will redirect to static index.html if IP is not approved:

<?php
// before anything else put this (replace with your dev IP and a valid static page URL):
if ($_SERVER['REMOTE_ADDR']!=='1.2.3.4'
  header
("Location: /index.html");
  exit;
}

Hi,
unfortunately I can’t get this code to work. I replaced all the code in my index.php with the lines above and put in my current IP address and the static url to my temporary index.html (http://www.mydoamin.com/folder/index.html). Can anyone point me into the right direction or give me a hint how to put my store offline for maintenance? Thanks in advance.

--

EDIT: Got it (finally). :|

 
Magento Community Magento Community
Magento Community
Magento Community
 
luric
Jr. Member
 
Avatar
Total Posts:  15
Joined:  2008-02-13
 

Is there a way to add additional/multiple IP adresses? I already tried the “or” variant, but it didn’t worked out.

Here’s what I tried:

if ($_SERVER['REMOTE_ADDR']!=='1.2.3.4' || $_SERVER['REMOTE_ADDR']!=='1.2.3.4'{

Any help is much appreciated.

 
Magento Community Magento Community
Magento Community
Magento Community
 
John R
Sr. Member
 
Total Posts:  90
Joined:  2008-08-21
 

What if I simply want to hide the option to switch stores?

 
Magento Community Magento Community
Magento Community
Magento Community
 
Gabriiiel
Guru
 
Avatar
Total Posts:  563
Joined:  2008-04-29
France - Paris
 

@ luric :

if (($_SERVER['REMOTE_ADDR'!= 'XX.XX.XX.XX') AND ($_SERVER['REMOTE_ADDR'!= 'XX.XX.XX.XX') AND ($_SERVER['REMOTE_ADDR'!= 'XX.XX.XX.XX') AND ($_SERVER['REMOTE_ADDR'!= 'XX.XX.XX.XX'))
{
    
require 'index.htm';
    die();
}

at the top of index.php

Hope it helps…

 
Magento Community Magento Community
Magento Community
Magento Community
 
JLeuze
Jr. Member
 
Avatar
Total Posts:  1
Joined:  2008-09-12
Minnesota
 

It would be great if you could switch to a maintenance mode right from the Magento control panel, WordPress has a few plugins that work great for doing this. But I understand that may be outside of the focus of the software.

Some of the solutions in this thread to set up a DIY maintenance mode seemed a like a tad bit of overkill for a non-guru like myself. For me, I don’t want anything that will hinder my access, or that of my clients. And I want a solution that can be disabled in a snap.

I found a way that worked well for me, and I wanted to share, in case others had the same need as myself. I poked around in the .htaccess file that comes packed with Magento, and found this chunk already handily included:

## default index file

    DirectoryIndex index.php

<IfModule mod_php5.c>

If you open “.htaccess “ in your favorite text editor(make a backup first), and do a find for “DirectoryIndex”, you’ll come right to the spot you need to edit.

Simply replace “index.php” with “index.html”, or whatever you so desire. Re-upload .htaccess, and your new index file.

Visit your Magento powered site, you will see that the new index file is live. Of course, manually add “index.php” to your website’s URL, and you can get back to Magento just fine!

When you are ready for your site to go live, either add “index.php” back in, or revert to your back up of .htaccess. If you keep the index.html and the modified .htaccess files handy, you could switch your site back into maintenance mode very quickly should the need arise!

 
Magento Community Magento Community
Magento Community
Magento Community
 
need4speed
Sr. Member
 
Total Posts:  84
Joined:  2008-11-22
 

I was looking for a IP access solution too since the defaultp IP access function in Magento doesnt work.

Thanks InDaMixXx!

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top
Page 1 of 2