Here my solution, works fine for me:
The below will call maintanance.php immediately, so you can go ahead and break your CI code without the world seeing it.
Also allow you to add you own ip address so that you can still access the site for testing etc.
In index.php add at top:
$maintenance = false; ## set to true to enable
if ($maintenance)
{
if (isset( $_SERVER['REMOTE_ADDR']) and $_SERVER['REMOTE_ADDR'] == 'your_ip')
{
##do nothing
} else
{
error_reporting(E_ALL);
ini_set('display_errors', 1); ## to debug your maintenance view
require_once 'maintenance.php'; ## call view
return;
exit();
}
}
Add file Maintanance.php in same folder as index.php (or update path above):
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Maintenance</title>
<style>
body {
width:500px;
margin:0 auto;
text-align: center;
color:blue;
}
</style>
</head>
<body>
<img src="images/home_page_logo.png">
<h1><p>Sorry for the inconvenience while we are upgrading. </p>
<p>Please revisit shortly</p>
</h1>
<div></div>
<img src="images/under-maintenance.gif" >
</body>
</html>
<?php
header('HTTP/1.1 503 Service Temporarily Unavailable');
header('Status: 503 Service Temporarily Unavailable');
header('Retry-After: 3600');
?>
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…