redirect all traffic except for 2 ip addresses
I'm trying to get some help with setting up a redirect properly. I'm not too skilled with .htaccess, so I likely have something coded incorrectly. I have it working correctly if I redirect users to say google, but not when I try to redirect users to a different directory on the same server.
what I'm trying to accomplish is to redirect all traffic, excluding 2 IP addresses, to an index.html file in a certain directory that's found on the server.
here's the code I'm using:
RewriteEngine On
RewriteBase /
RewriteCond %{REMOTE_HOST} !^1.2.3.4
RewriteRule .* http://www.mysite.com/new [R=302,L]
my IP is plugged in where 1.2.3.4 is listed as well as the mysite.com/new being replaced with my domain name.
directory set up:
apache is reading files from /var/www. the .htaccess resides in /var/www/. I'd like to redirect all users to an index.html file found in /var/www/new/. is this possible? if so, how is it properly written in the .htaccess file?
I also tried this code, and it hasn't worked:
RewriteEngine On
RewriteBase /
RewriteCond %{REMOTE_HOST} !^1.2.3.4
RewriteRule ^/$ /new/ [R]
any help is appreciated.