Problem 1
It is little difficult but i have 3+ addon domain and their folders are in the root.. So example
www/index.php ROOTSITE.COM
www/example.com/index.php example.COM
www/example2.com/index.php example2.COM
Remember the above example.com and example2.com is folders inside mains
So when i put the ROOTSITE.COM to maintenance mode.. by 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 to root.com/maintanance.html Kindly tell a way to avoid making example sites to non maintanance mode.. Just like that i do not want any .htaccess rules on the root to affect the addon domain (in the folders)
Problem 2
Also other thing I need some pre made count down timer (in hours:min:sec) when site goes under maintenance mode... After the countdown ends it must divert to rootsite.com.... can it also change .htaccess? i mean when the count down ends it must change the rule of the .htaccess to remove rule of maintanance mode.
.htaccess
applies to all physical subdirectories, regardless of the virtual host.
Solution 1:
Create www/example.com/.htaccess
containing:
RewriteEngine On
This will override any rewriting rules in higher-level directories.
Solution 2:
Don't put maintenance rewriting rules in .htaccess
. Instead, put them directly in the <VirtualHost>
section in the configuration file of your root site.
Put a condition on your rule based on the current date using the date variables. E.g.
RewriteCond %{TIME_YEAR}-%{TIME_MON}-%{TIME_DAY}T%{TIME_HOUR} \
2011-02-18T(09|1.|20) # 9 am to 9 pm today
This constructs a string of the current date and hour from the TIME_*
variables, e.g. 2011-02-18T15
(this is a prefix of the date in ISO format). You can construct a longer string including minutes and seconds if you need the granularity.
The regex matches the number range 9 to 20, so it will match times from 09:00:00 to 20:59:59, i.e., 9 am to 9 pm.
Add this condition next to your other two RewriteCond
directives and the rule will only be active in a certain time range.