php - maintenance mode on root avoid addon domains -
problem 1
it little difficult have 3+ addon domain , folders in root.. example
www/index.php rootsite.com www/example.com/index.php example.com www/example2.com/index.php example2.com
remember above example.com , example2.com folders inside mains
so when put rootsite.com maintenance mode.. using
rewriteengine on rewritebase / rewritecond %{remote_addr} !^11\.111\.111\.111 rewritecond %{request_uri} !^/maintenance\.html$ rewriterule ^(.*)$ http://rootsite.com/maintenance.html [r=307,l]
it diverst example.com example1.com root.com/maintanance.html kindly tell way avoid making example sites non maintanance mode.. not want .htaccess rules on root affect addon domain (in folders)
problem 2
also other thing need pre made count down timer (in hours:min:sec) when site goes under maintenance mode... after countdown ends must divert rootsite.com.... can change .htaccess? mean when count down ends must change rule of .htaccess remove rule of maintanance mode.
problem 1
.htaccess
applies physical subdirectories, regardless of virtual host.
solution 1:
create www/example.com/.htaccess
containing:
rewriteengine on
this override rewriting rules in higher-level directories.
solution 2:
don't put maintenance rewriting rules in .htaccess
. instead, put them directly in <virtualhost>
section in configuration file of root site.
problem 2
put condition on rule based on current date using date variables. e.g.
rewritecond %{time_year}-%{time_mon}-%{time_day}t%{time_hour} \ 2011-02-18t(09|1.|20) # 9 9 pm today
this constructs string of current date , hour time_*
variables, e.g. 2011-02-18t15
(this prefix of date in iso format). can construct longer string including minutes , seconds if need granularity.
the regex matches number range 9 20, match times 09:00:00 20:59:59, i.e., 9 9 pm.
add condition next other 2 rewritecond
directives , rule active in time range.
Comments
Post a Comment