Maintain the list of exempt IP addresses

To maintain the list of exempt IP addresses, you can either use the [--ip=<ip list>] option in the preceding commands or you can use the following:

bin/magento maintenance:allow-ips <ip address> .. <ip address> [--none]

The <ip address> .. <ip address> syntax is an optional space-delimited list of IP addresses to exempt.

The --none option clears the list.

Multi-store setups

If you want to set up multiple stores, each with a different layout and localized content, pass the $_GET['skin'] parameter to the intended processor.

In the following example, we are using a 503 type error template file, which requires localized content.

The constructor of the Error_Processor class accepts a skin GET parameter to change the layout:

if (isset($_GET['skin'])) {
    $this->_setSkin($_GET['skin']);
}

This can also be added to a rewrite rule in the .htaccess file that appends a skin parameter to the URL.

$_GET[‘skin’] parameter

To use the skin parameter:

  1. Check if the .maintenance.flag exists.

  2. Note the host address, that refers to the HTTP_HOST, or any other variable such as ENV variables.

  3. Check if the skin parameter exists.

  4. Set the parameter by using the rewrite rules below.

    Here are some examples of rewrite rules:

    • RewriteCond %{DOCUMENT_ROOT}/var/.maintenance.flag -f
    • RewriteCond %{HTTP_HOST} ^sub.example.com$
    • RewriteCond %{QUERY_STRING} !(^|&)skin=sub(&|$) [NC]
    • RewriteRule ^ %{REQUEST_URI}?skin=sub [L]
  5. Copy the following files:

    • pub/errors/default/503.phtml to pub/errors/sub/503.phtml
    • pub/errors/default/css/styles.css to pub/errors/sub/styles.css
  6. Edit these files to provide localized content in the 503.phtml file and custom styling in the styles.css file.

    Ensure your paths point to your errors directory. The directory name must match the URL parameter indicated in the RewriteRule. In the previous example, the sub directory is used, which is specified as a parameter in the RewriteRule (skin=sub)

NOTE
The nginx setting must be added for multi-store setups.
Previous pageDisplay or change the Admin URI
Next pageEnable or disable modules