Let's say we have a website. How to make so that when loading any page we are redirected to the page where it is said that technical work is going on (adding content, changing the look)? How to do this in PHP?
2 answers
Redirect to closed.php:
<?php header('Location: closed.php'); // какой-то код ?>
- oneAnd what if I have, for example, a forum. Several hundred users. What to register in each page? Is it possible to make one file which is all for me (parameters or settings)? Well, or a .htacess file to fix? - MrGons18
- oneInstead of "some kind of code" it is better to write exit; in order to be completely sure that if there is a great demand on this page, the script will immediately come out. - Andrei Arshinov
- Well, exit is understandable. And what about comment 1? - MrGons18
- one@Mrgons18, write to the file where you have to connect to the database, for example. - ModaL
- oneIn principle, any forum (if it is a forum engine) should have in its functionality the ability to temporarily close access for everyone except administrators. What engine? - Andrei Arshinov
|
Better to do this with .htaccess
:
RewriteRule ^(?!closed\.php$).*$ closed.php [L]
All possible requests for one page. At the end of the work, delete this line from .htaccess
|