Is it possible to put a magento site under an maintenance flag so that visitors will get a message that the site is under construction? I can\'t find this setting in the admin a
The following would work with an apache installation (need to check with others).
You could create your own custom site under maintenance html page say index.html
and place it in the root directory of your installation.
Open the .htaccess
folder and rename the default page from index.php
to index.html
. Restart Apache. Once you are done rename the default page back to index.php
.
It should work.
Just add a blank file called maintenance.flag to your root.. job done
A neater solution is to use this extension.
it allow you to set the store up so that once logged into the back end you have access to the front + a few other neat features
If you need to put Magento in maintenance mode only in frontend, leaving admin enabled for authentication you can try these steps:
Search for the content below (around line 63):
if (file_exists($maintenanceFile)) {
Replace for:
if (file_exists($maintenanceFile) && !preg_match('/^\/(admin|index.php\/admin)/', $_SERVER['REQUEST_URI'])) {
Create a blank file named maintenance.flag in your Magento root installation:
$ touch maintenance.flag
This solution was inspired in the maintenance mode used in Opencart that uses the same behavior.
I use this often. http://inchoo.net/ecommerce/magento/maintenance-mode-in-magento/
The important part is:
Open: index.php in root and above line 57 add (remembering to edit the ‘allowed’ array to contain the IP’s you want to be able to access the site);
$ip = $_SERVER['REMOTE_ADDR']; $allowed = array('1.1.1.1','2.2.2.2'); // these are the IP's that are allowed to view the site.
then change the line
if (file_exists($maintenanceFile)) {
to
if (file_exists($maintenanceFile) && !in_array($ip, $allowed)) {
Thats what I add to the index in order to be able to continue working from different IPs:
//EGS to show a maintenance page but be able to work
$ip = $_SERVER['REMOTE_ADDR'];
// these are the IP's that are allowed to view the site:
$allowed = array('111.111.111.111', '222.222.222.222');
if (file_exists($maintenanceFile) && !in_array($ip, $allowed)) {
include_once dirname(__FILE__) . '/errors/503.php';
exit;
}
Check out this http://www.magentocommerce.com/magento-connect/all4coding-offline-maintenance-page.html it provide exactly what you are looking for. compatible with magento 1.4 - 1.8.
You can also display the maintenance page with your design theme.