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:
-
Check if the
.maintenance.flag
exists. -
Note the host address, that refers to the
HTTP_HOST
, or any other variable such as ENV variables. -
Check if the
skin
parameter exists. -
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]
- RewriteCond
-
Copy the following files:
pub/errors/default/503.phtml
topub/errors/sub/503.phtml
pub/errors/default/css/styles.css
topub/errors/sub/styles.css
-
Edit these files to provide localized content in the
503.phtml
file and custom styling in thestyles.css
file.Ensure your paths point to your
errors
directory. The directory name must match the URL parameter indicated in theRewriteRule
. In the previous example, thesub
directory is used, which is specified as a parameter in theRewriteRule
(skin=sub
)