stef
stef

Reputation: 27749

htaccess rules filtered on IP

I have the following htaccess rule I'd like to apply for every IP address apart from mine. I basically want to show a "site is down" page for everyone apart from myself. How is this best achieved?

RewriteEngine on
RewriteCond %{REQUEST_URI} !/indexTEMP.php$ 
RewriteRule $ /indexTEMP.php [R=307,L]

Upvotes: 1

Views: 687

Answers (1)

Pekka
Pekka

Reputation: 449495

The Apache variable is REMOTE_ADDR.

Untested but should work:

RewriteEngine on
RewriteCond %{REQUEST_URI} !/indexTEMP.php$ 
RewriteCond %{REMOTE_ADDR} !^192\.168\.0\.1$ 
RewriteRule $ /indexTEMP.php [R=307,L]

this applies the rule to every IP except 192.168.0.1.

Upvotes: 1

Related Questions