title: Problems breaking an .htaccess redirect out of an infinite loop
body: <p>So I have asked for help over at my weblog, scoured the internet, and pored over the examples you all have provided on here before, and I still cannot find an answer that works.  </p>
  
  <p>Simply put, I am trying to take all traffic referred to my site from Site A, and redirect it all to Page B within my domain.  I have gotten the redirect to work perfectly, but I cannot get it to break out of an infinite loop.  Any assistance would be greatly appreciated.  </p>
  
  <p>Code follows (though it has been "anonymized" from the specific pages I was using):  </p>
  
  <pre><code>&lt;IfModule mod_rewrite.c&gt;
  Options +FollowSymlinks
  RewriteEngine on
  RewriteBase /
  RewriteCond %{REQUEST_FILENAME} !filename\.html$
  RewriteCond %{HTTP_REFERER} ^http://online\.webpage\.com.* [NC]
  RewriteRule (.*) http://www.wallsofthecity.net/year/mo/filename.html [L]
  &lt;/IfModule&gt;
  </code></pre>
  
  <p>Like I said, the RewriteRule works beautifully, but the first RewriteCond does not appear to be flagging when it is at the appropriate page, and just keeps redirecting folks, ad nauseum.  I have been using this site:  <a href="http://rexswain.com/httpview.html" rel="nofollow noreferrer">http://rexswain.com/httpview.html</a> to check my code, and while useful, it has not given me any good answers.  </p>
  
  <p>Thanks for whatever help you can provide.  </p>
  
  <p>UPDATE:  </p>
  
  <p>So here is the .htacces file in its entirety, since that may make things easier:  </p>
  
  <pre><code>&lt;IfModule mod_rewrite.c&gt;
  RewriteEngine On
  
  # Force an external redirect to this page for referrals from that site
  # This page *must* exist to prevent a loop (which it does, I checked :P)
  RewriteCond %{HTTP_REFERER} ^http://mikeb302000\.blogspot\.com.* [NC]
  RewriteCond %{REQUEST_URI} !=/2010/04/cruisin-for-a-bruisin.html
  RewriteRule . /2010/04/cruisin-for-a-bruisin.html [R,L]
  
  # This scenario performs no rewrite, so it should actually just be handled by
  # the RewriteConds below (they won't match), but I didn't test that
  RewriteCond %{REQUEST_URI} ^/(stats|failed_auth\.html).*$ [NC]
  RewriteRule . - [L]
  
  Redirect permanent /index.xml http://www.wallsofthecity.net/feed/
  Redirect permanent /rss.xml http://www.wallsofthecity.net/feed/
  Redirect permanent /atom.xml http://www.wallsofthecity.net/feed/atom/
  Redirect permanent /12_tribes http://www.wallsofthecity.net/category/12-tribes
  Redirect permanent /as_i_say_not_do http://www.wallsofthecity.net/category/as-i-say-not-do
  Redirect permanent /bigotry_exposed http://www.wallsofthecity.net/category/bigotry-exposed
  Redirect permanent /commercial_appeal http://www.wallsofthecity.net/category/commercial-appeal
  Redirect permanent /cowardice_on_parade http://www.wallsofthecity.net/category/cowardice-on-parade
  Redirect permanent /crosscountry_jaunt http://www.wallsofthecity.net/category/crosscountry-jaunt
  Redirect permanent /digital_real_estate http://www.wallsofthecity.net/category/digital-real-estate
  Redirect permanent /fools_and_jesters http://www.wallsofthecity.net/category/fools-and-jesters
  Redirect permanent /for_hire http://www.wallsofthecity.net/category/for-hire
  Redirect permanent /me_myself_and_i http://www.wallsofthecity.net/category/me-myself-and-i
  Redirect permanent /musings_of_a_madman http://www.wallsofthecity.net/category/musings-of-a-madman
  Redirect permanent /one-line_review http://www.wallsofthecity.net/category/one-line-review
  Redirect permanent /patron_polity_of_perforation http://www.wallsofthecity.net/category/patron-polity-of-perforation
  Redirect permanent /peoples_republic_of_kalifornistan http://www.wallsofthecity.net/category/peoples-republic-of-kalifornistan
  Redirect permanent /sensor_ping http://www.wallsofthecity.net/category/sensor-ping
  Redirect permanent /serenity http://www.wallsofthecity.net/category/serenity
  Redirect permanent /simon_jester http://www.wallsofthecity.net/category/simon-jester
  Redirect permanent /the_funnies http://www.wallsofthecity.net/category/the-funnies
  Redirect permanent /the_mat http://www.wallsofthecity.net/category/the-mat
  Redirect permanent /things_that_go_boom http://www.wallsofthecity.net/category/things-that-go-boom
  Redirect permanent /toysgizmosgadgets http://www.wallsofthecity.net/category/toysgizmosgadgets
  Redirect permanent /urk http://www.wallsofthecity.net/category/urk
  Redirect permanent /window_on_the_world http://www.wallsofthecity.net/category/window-on-the-world
  
  &lt;/IfModule&gt;
  
  # 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;
  </code></pre>
  
  <p>Note:  it still does not appear to be working.  Test away :).  </p>