0

I am trying to implement maintenance page in apache 2.4 without restart and for specific 503 error code. I am following this site https://www.shellhacks.com/redirect-site-maintenance-page-apache-htaccess/

Below is my html file, image file maintenance.svg is also in same root htdocs folder:

<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
body, html {
  height: 100%;
  margin: 0;
  /* The image used */
  background-image: url("maintenance.svg");
  /* Full height */
  height: 100%; 

  /* Center and scale the image nicely */
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
}
</style>
</head>
<body>
</body>
</html>

ReWrite rule as below :

DocumentRoot "${SRVROOT}/htdocs"
RewriteEngine On
RewriteCond %{DOCUMENT_ROOT}/maintenance.html -f
RewriteCond %{DOCUMENT_ROOT}/maintenance.enable -f
RewriteCond %{SCRIPT_FILENAME} !maintenance.html
RewriteRule ^.*$ /maintenance.html [L]
ErrorDocument 503 /maintenance.html

I am not expert in Apache, Need your help to load image using rewrite rule.

1 Answers1

0

The final RewriteCond is what's doing exceptions to the rewrite. You can add another and it is implicitly AND'ed with the previous ones:

RewriteCond %{REQUEST_URI} !maintenance.svg
covener
  • 17,402
  • 2
  • 31
  • 45