I am finished setting up a maintenance function on my webpage. This is the index.php code
<?php
session_start();
require_once("system/functions.php");
require_once("system/config.php");
if($maintenance == 1){
require_once(header("Location: index.php?page=maintenance"));
die();
session_destroy();
}elseif($maintenance == 0)
{
getPage();
}
?>
I have also tried with
header("Location: index.php?page=maintenance");
Instead of the require once header code above. But if I put
require_once("frontend/pages/maintenance.php");
It will work. The problem then is that people can type in every page they want in the address bar and this will show up. I need it to use it's own url (Which works with the 2 header codes above, but I get too many redirects error) and no matter what, you will be redirected to this url to see the maintenance screen
The php part of the maintenance.php file:
<?php
if($maintenance == 0){
header("Location: index.php?page=index");
die();
}
else{
header("Location: index.php?page=maintenance");
die();
}
?>
I can remove the else code part on the maintenance.php file, but then it will always redirect to "websitename"/index.php(Still maintenance screen though, the same problem as mentioned above)
So I need to change my code so when there is maintenance, you will be redirected to index.php?page=maintenance no matter what. Sorry if I missed out on some details, it's late. Feel free to ask me about this, if it is needed :)