Skip to content

Instantly share code, notes, and snippets.

@hasantayyar
Last active April 19, 2020 19:20
Show Gist options
  • Star 9 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save hasantayyar/10018548 to your computer and use it in GitHub Desktop.
Save hasantayyar/10018548 to your computer and use it in GitHub Desktop.
Maintenance page redirection with htaccess
# check if there is a file named maintenance.html
# so when you want to disable maintenance mode just remname "mv maintenance.html maintenance.html.disabled"
RewriteCond %{DOCUMENT_ROOT}/maintenance.html -f
RewriteCond %{SCRIPT_FILENAME} !maintenance.html
RewriteRule ^.*$ /maintenance.html [R=503,L]
ErrorDocument 503 /maintenance.html
<!-- Sample maintenance page -->
<!DOCTYPE html>
<html>
<head>
<title>Down For Maintenance</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<style>
h1 { font-size: 50px; }
body { text-align:center; font: 20px Helvetica, sans-serif; color: #333; }
</style>
</head>
<body>
<h1>Down For Maintenance</h1>
<p>Sorry for the inconvenience, but we’re performing a maintenance at the moment.</p>
<p>We’ll be back online shortly!</p>
</body>
</html>
@yosemite-windows
Copy link

perfect solution !
thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment