Magento – How to redirect to new page on maintenance mode

magento-1.9

I think I'm missing something. I attempted to do this the "proper" magento 1.x way:

  • Copied rootDir/errors/default to rootDir/errors/janitor
  • Changed <skin>default</skin> to <skin>janitor</skin>
  • Updated code in rootDir/errors/janitor/503.phtml as needed.

This kind of works. The problem is the edits to 503.phtml basically make it a new page. It sends headers, it has a full <html> .. </html> structure etc.

Obviously what ends up happening is page.phtml renders first, with the contents of 503.phtml inside that page as the body.

I COULD completely change page.html but I would like to keep using the default for every other error (404, etc.)

The 503/maintenance page is a separate entity with its own markup, styles, logo and so forth.

Right now the solution is simply to bypass all this by changing the logic in rootDir/index.php to load my custom maintenance page rather than go through the standard magento error processing/rendering of 503.phtml.

Best Answer

Magento goes to maintenance mode when you create a file named maintenance.flag to your Magento home directory. This is how Magento handles it:

$maintenanceFile = 'maintenance.flag';

if (file_exists($maintenanceFile)) {
    include_once dirname(__FILE__) . '/errors/503.php';
    exit;
}

If you want to custom and design it, follow this one.

Related Topic