Redirecting everyone except my two machines?

I have the following in my .HTACCESS file:

RewriteEngine On
RewriteBase /
RewriteCond %{REMOTE_HOST} !^127\\.0\\.0\\.1
RewriteCond %{REMOTE_HOST} !^159\\.112\\.48\\.147
RewriteCond %{REMOTE_HOST} !^159\\.112\\.48\\.83
RewriteCond %{REQUEST_URI} !/projects/xcs_wiki$  
RewriteRule .* /projects/xcs_wiki [R=302,L]

I’m trying to redirect everyone to my /projects/xcs_wiki location on my server (relative to my Apache root). I have 2 computers in all this: box1 and box2. The WAMP setup (my development environment) is on box1 but I do unauthenticated / “random visitor” testing from box 2 as it speeds up the whole process…

Anyway, keeping the above .HTACCESS code in mind, everything seems to test perfectly fine when browsing from box2 using Firefox. When I try to browse from box1, however, I get redirected. Why is this?

Does this have something to do with REMOTE_HOST vs. REMOTE_ADDR? Did I get that wrong?

Basically, for me, it’s nice being able to browse my directories and if I’m being redirected on box1, I can no longer browse my directories…

Any insight into this is appreciated.

W22,

First, :tup: for catching your localhost in your {REMOTE_ADDR} sequence. Unfortunately, you’re not after {REMOTE_HOST} but {REMOTE_ADDR} to fetch the address of the visiting computer.

Good plan, though!

Regards,

DK

Made the change and it seems to be working like a charm. Thanks DK. :slight_smile:

W22,

:tup: You’re welcome!

Regards,

DK