We have add-on domains to the same directory of our website, 1 of the domain is for us to access and test the website. I want to activate Maintenance mode excluding our test domain so we can access the site and do our tests.
Asked
Active
Viewed 19 times
1 Answers
0
%{HTTP_HOST}
is to test the domain name. If the HTTP_HOST
is not the test.com domain, and the REQUEST_URI
is not the maintenance.php (to prevent a redirect loop) redirect the traffic to the maintenance page.
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.test\.com [NC]
RewriteCond %{REQUEST_URI} !^/maintenance.php$
RewriteRule ^/?(.*) /maintenance.php?$1 [R=301]

Valeriu Ciuca
- 2,084
- 11
- 14