0

https://devdocs.magento.com/guides/v2.4/comp-mgr/trouble/cman/maint-mode.html#compman-trouble-maint-create

I have followed this guide to enable maintenance mode and create a maintenance page.

I have add new 4 file in root

  • /maintenance_files/styles.css
  • /maintenance_files/widgets.css
  • /maintenance_files/pelle_meca.png

and add this code in root .htaccess file.

RewriteEngine On
RewriteCond %{REMOTE_ADDR} !^192\.0\.2\.110
RewriteCond %{DOCUMENT_ROOT}/maintenance.html -f
RewriteCond %{DOCUMENT_ROOT}/maintenance.enable -f
RewriteCond %{SCRIPT_FILENAME} !maintenance.html
RewriteRule ^.*$ /maintenance.html [R=503,L]
ErrorDocument 503 /maintenance.html
Header Set Cache-Control "max-age=0, no-store"

I have enabled maintenance mode and create file maintenance.enable in doc root.

Now all Url is rewritten on the maintenance page but CSS and image are also rewritten and page structure is messed up.

error in maintenance mode console

1 Answer 1

0

As you have seen this method will rewrite all server requests so if you want to display a more complex maintenance page with calls to css, js or images these requests will be rewritten too and the page will not work as you expect.

You either need to simplify your maintenance page with all styling, scripts and images inline or move the maintenance page to another server.

I wrote a blog post about a similar solution I developed when using NGINX as a frontend proxy.

https://blog.gaiterjones.com/magento-2-custom-dynamic-maintenance-page-with-nginx/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.