<p>Basically I'm about to start work on a site and I'd like something that I can add into my .htaccess file (or elsewhere) that'll work like this pseudo code: (my ip will be in place of 127.0.0.1)</p>

<pre><code>if (visitors_ip &lt;&gt; 127.0.0.1)
    redirectmatch ^(.*)$ http://www.example.com/under-construction.html
</code></pre>

<p>Hopefully that makes sense...</p>

That would be
something like
:
```
```
RewriteEngine On
RewriteBase /
RewriteCond %{REMOTE_ADDR} !^127\.0\.0\.1

RewriteCond %{REQUEST_URI} !/mypage\.html$  

RewriteRule .* http://www.anothersite.com/mypage.html [R=302,L]
```
```
As
Andrew
points out, the %{REQUEST_URI} condition avoids infinite loop if you redirect to the same domain.
As
Xorax
comments
almost 9 years later
:
You should not use
```
REMOTE_HOST
```
, it will fail in many case. You should use
```
REMOTE_ADDR
```
.
Cf "
difference between
```
REMOTE_HOST
```
and
```
REMOTE_ADDR
```
"