Skip to content

Instantly share code, notes, and snippets.

@Jamiewarb
Last active June 16, 2017 08:48
Show Gist options
  • Save Jamiewarb/8e38bf1ce3cbd17e3efeefdab949dbaf to your computer and use it in GitHub Desktop.
Save Jamiewarb/8e38bf1ce3cbd17e3efeefdab949dbaf to your computer and use it in GitHub Desktop.
Maintenance page using .htaccess
# Maintenance page
RewriteCond %{REMOTE_ADDR} !^000\.000\.000\.000
RewriteCond %{REQUEST_URI} !^/maintenance\.php$
# Allow a specific requ
RewriteCond %{REQUEST_URI} !^/company-logo.png$ [NC]
# Allow a series of filetypes
RewriteCond %{REQUEST_URI} !\.(css|jpe?g?|png|gif|woff|ttf) [NC]
RewriteRule ^(.*)$ https://www.domain.com/maintenance.php [R=307,L]
<!DOCTYPE html>
<html>
<head>
<title>Site Maintenance</title>
<style type="text/css">
body { text-align: center; padding: 150px; }
h1 { font-size: 50px; }
body { font: 20px Helvetica, sans-serif; color: #333; }
article { display: block; text-align: left; width: 650px; margin: 0 auto; }
a { color: #dc8100; text-decoration: none; }
a:hover { color: #333; text-decoration: none; }
p { line-height: 1.4; }
</style>
</head>
<body>
<article>
<h1>We&rsquo;ll be back soon</h1>
<div>
<p>Sorry for the inconvenience but we&rsquo;re performing some maintenance at the moment. We&rsquo;ll be back online shortly.</p>
</div>
</article>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment