Skip to content

Instantly share code, notes, and snippets.

@real34
Last active December 10, 2015 00:29
Show Gist options
  • Save real34/4352078 to your computer and use it in GitHub Desktop.
Save real34/4352078 to your computer and use it in GitHub Desktop.
Page de maintenance simple et configurable avec .htaccess pour rediriger vers elle
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
# RewriteCond %{REMOTE_ADDR} !^123\.123\.123\.123 # Allowed IP
RewriteCond %{REQUEST_URI} !^/maintenance.php [NC]
RewriteRule .* /maintenance.php [L]
<?php
header('HTTP/1.1 503 Service Temporarily Unavailable');
header('Status: 503 Service Temporarily Unavailable');
header('Retry-After: 3600');
// Variables à modifier
$nomSite = 'xxx';
$nomSousLogo = true;
$logoUrl = 'https://dl.dropboxusercontent.com/u/7161334/logo-stg.gif';
$heureDebut = '16h40';
$dureeInterruption = '1 heure';
?>
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="utf-8">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="Refresh" content="10">
<title>Site en cours de Maintenance</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">
<!-- Le styles -->
<link href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet">
<style>
body { padding-top: 60px; /* 60px to make the container go all the way
to the bottom of the topbar */ }
</style>
<!-- Le HTML5 shim, for IE6-8 support of HTML5 elements -->
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js">
</script>
<![endif]-->
</head>
<body>
<div class="container">
<div class="text-center">
<?php
if (!empty($logoUrl)) :
echo '<img src="' . $logoUrl . '" alt="Logo" /><br>';
endif;
if (!empty($nomSousLogo)) :
echo $nomSite;
endif;
?>
</div>
<div class="jumbotron" style="margin-top:2em">
<h1>
Site en cours de maintenance
</h1>
<p>
<strong><?php echo $heureDebut ?></strong> : Notre site est en cours de maintenance afin d'améliorer notre
service. L'interruption ne devrait pas durer plus de <strong><?php echo $dureeInterruption; ?></strong>.
</p>
<p>
Veuillez nous excuser pour le désagrément. Cette page sera actualisée
régulièrement et vous serez redirigé lorsque le site sera à nouveau accessible.
</p>
<a class="btn btn-primary" href="">
<i class="glyphicon glyphicon-refresh"></i>
Actualiser
</a>
</div>
<div class="row">
</div>
<hr>
<div>
© <?php echo $nomSite . ' ' . date('Y') ?>
</div>
</div>
<script src="//netdna.bootstrapcdn.com/bootstrap/3.1.1/js/bootstrap.min.js"></script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment