I searched to find an easy way to do maintenance on our site without leaving our directory structure open for any length of time. In my search everyone was suggesting modifying the .htaccess (not unless I absolutely have too). Then there were suggestions about using php's header location option, problem was what if I needed to test for potential errors I couldn't work within the main file. So I came up with this short and simple:
Code:
<?php
$OFFLINE = 0;
if($OFFLINE){ require_once('maintenance.php'); exit; }
else{ require_once('whatever.php'); exit; }
?>
Simply copy and paste into your main index.php file and save so it begins working immediately. Next move all the other code to a new file 'whatever.php'. You can now work on your website using your file manager without interferring in normal operations and no excessive codes to .htaccess by simple changing the variable to true(1) will redirect. When done testing reset to 0 for normal ops.

I would like to see if some of you pros would help develope it even more...
1. Deal with multiple (possible) errors.
a. 'File Not Found!' would be if(!file_exists(fileneame.php)){ require_once('file_not_found.php'); exit; }

Plus it could even be upated more to include IP & website blocking...
a. check for 'blocking' file existance, if so test entries.

I figure it would use a lot of elseif statements to check for various things what do you think?
Any other ideas to test?