To put site under construction or under maintainence mode
Step 1:
In codeigniter root index.php file make it the below line of code available
define('MAINTENANCE_MODE', $_SERVER['REMOTE_ADDR']=="YOUR_IP_ADDRESS" ? 'NO':'YES' ); //This line of code tells if the ip address is yours open website else doesn't
Step :2
make this code available in application/config/routes.php
if(MAINTENANCE_MODE=='YES'){
echo "<h1 style='text-align:center'>Site is under maintenance mode</h1>";
echo "<p style='text-align:center'>Please visit again</p>";
exit;
}
In Advance to open website in some ip address the below is the example
Step 1:
In codeigniter root index.php file make it the below line of code available
function check_maintenance(){
$arr = ['ip1','ip2']; //specify ur ip address here
for($i=0, $l=count($arr); $i<$l; $i++){
if(in_array($_SERVER['REMOTE_ADDR'],$arr)){
return true;
}
}
return false;
}
define('MAINTENANCE_MODE', check_maintenance()==TRUE ? 'NO':'YES' ); //This line of code tells if the ip address is yours open website else doesn't
Step :2
make this code available in application/config/routes.php
if(MAINTENANCE_MODE=='YES'){
echo "<h1 style='text-align:center'>Site is under maintenance mode</h1>";
echo "<p style='text-align:center'>Please visit again</p>";
exit;
}
Step 1:
In codeigniter root index.php file make it the below line of code available
define('MAINTENANCE_MODE', $_SERVER['REMOTE_ADDR']=="YOUR_IP_ADDRESS" ? 'NO':'YES' ); //This line of code tells if the ip address is yours open website else doesn't
Step :2
make this code available in application/config/routes.php
if(MAINTENANCE_MODE=='YES'){
echo "<h1 style='text-align:center'>Site is under maintenance mode</h1>";
echo "<p style='text-align:center'>Please visit again</p>";
exit;
}
In Advance to open website in some ip address the below is the example
Step 1:
In codeigniter root index.php file make it the below line of code available
function check_maintenance(){
$arr = ['ip1','ip2']; //specify ur ip address here
for($i=0, $l=count($arr); $i<$l; $i++){
if(in_array($_SERVER['REMOTE_ADDR'],$arr)){
return true;
}
}
return false;
}
define('MAINTENANCE_MODE', check_maintenance()==TRUE ? 'NO':'YES' ); //This line of code tells if the ip address is yours open website else doesn't
Step :2
make this code available in application/config/routes.php
if(MAINTENANCE_MODE=='YES'){
echo "<h1 style='text-align:center'>Site is under maintenance mode</h1>";
echo "<p style='text-align:center'>Please visit again</p>";
exit;
}
0 comments:
Post a Comment