Thursday, 15 July 2010

php - Correct way to handle maintenance mode from a Database setting -



php - Correct way to handle maintenance mode from a Database setting -

building cms , looking find out right way of showing maintenance mode message users.

my plan have alternative in admin backend. have table in db website config , have field has value. using 1 normal , 2 maintenance mode. want able update database.

my question however, whats proper way this?

my first thought check db , if value "2" redirect user (all php) e.g. 503.php.

but have seen improve way in .htaccess , can allow ip still have access. can in .htaccess managed database check?

looking things curious the 'standards' way of doing this.

is first suggestion feasible? main reason 'maintenance mode' protect myself. site has gone through lots of testing, want way can shut downwards access site (seo freindly) whilst prepare issues. or whilst updating site itself.

thanks

you shouldn't command maintenance mode setting database, if don't have to.

the database adds layer of complexity may fail @ point.

in practice, have few options:

add text file setting maintenance mode. prior serving request, utilize php open , read value of file. then, can handle appropriately issuing redirect if needed.

use external service pingometer monitor site(s). automates process and, if of them go down, utilize web hook functionality send request php script switches value (perhaps using method described in #1) maintenance mode.

i think goal that, if happens site (externally), maintenance mode automatically tripped -- #1 , #2 offer easy solution.

php .htaccess http-status-code-503 maintenance-mode

No comments:

Post a Comment