views:

45

answers:

1

I am writing one web application using PHP/CodeIginter.

Now, I want to add a .htaccess while I am upgrading the application in the server. The purpose of this .htaccess will be: -

  1. It'll allow normal operation if the user is accessing

    • from some specific IPs, and
    • Using a particular host name alias
    • has a query string parameter "upgrading=1" in the URL
  2. Otherwise, it'll show a message: "site is under construction".

+2  A: 

Try this rule:

RewriteCond %{REMOTE_ADDR} !=127.0.0.0 [OR]
RewriteCond %{HTTP_HOST} !=specific.host.example [OR]
RewriteCond %{QUERY_STRING} !^([^&]*&)*upgrading=1(&.*)?$
RewriteRule !^maintenance\.html$ maintenance.html [L]
Gumbo