title: Why is this .htaccess redirect not working?
body: <p>I have two identical versions of a website, both using different AWS EC2 instances(staging xx.xx.xx.xx and production xxx.xxx.xxx.xxx).  I want to create a 301 redirect that redirects all users from the staging site to the production site, UNLESS they are visiting from my IP.  I thought this was a relatively simple task, but I have attempting to make this work for the last couple hours with no resolution. I am hoping that someone here will be able to point me in the right direction. Currently, the redirect works for visitors to the homepage <a href="http://xx.xx.xx.xx" rel="nofollow noreferrer">http://xx.xx.xx.xx</a>, but it does not work for other pages such as <a href="http://xx.xx.xx.xx/page1" rel="nofollow noreferrer">http://xx.xx.xx.xx/page1</a> or the ec2 public DNS like <a href="http://ec2-xx-xx-xx-xx.us-west-1.compute.amazonaws.com/" rel="nofollow noreferrer">http://ec2-xx-xx-xx-xx.us-west-1.compute.amazonaws.com/</a>  Here is my entire .htaccess file, the redirect I added is the last one.  Any help you could give me would be much appreciated!!</p>
  
  <pre><code># BEGIN WordPress
  &lt;IfModule mod_rewrite.c&gt;
  RewriteEngine On
  RewriteBase /
  RewriteRule ^index\.php$ - [L]
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule . /index.php [L]
  &lt;/IfModule&gt;
  
  php_value upload_max_filesize 64M
  php_value post_max_size 64M
  php_value max_execution_time 300
  php_value max_input_time 300
  
  # END WordPress
  
  RewriteEngine on
  RewriteRule ^(.*)$ http://newsite.com/$1 [L,R=301,NC]
  RewriteBase /
  RewriteCond %{HTTP_HOST} !newsite.com$ [NC]
  RewriteCond %{REMOTE_ADDR} !=xxx.xxx.xxx.xxx
  </code></pre>