title: 301 RedirectMatch - Many URLs
body: <p>I have the below htaccess code in place:</p>
  
  <pre><code>Options +FollowSymLinks
  
  &lt;IfModule mod_rewrite.c&gt;
  RewriteEngine On
  RewriteBase /
  
  RedirectMatch 301 ^/([^-]+)-([^-]+)-([^-]+)-([^-]{2})\.html$ /$1-$2-in-$3-$4.html
  RedirectMatch 301 ^/([^-]+)-([^-]+)-([^-]+)\.html$ /$1-$2-in-$3.html
  
  # BEGIN WordPress
  RewriteRule ^index\.php$ - [L]
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule . /index.php [L]
  &lt;/IfModule&gt;
  # END WordPress
  </code></pre>
  
  <p>I am trying to automatically redirect pages to include 'in' per the new URL structure. The two RedirectMatch lines above work for two scenarios, but I need a third scenario to be possible.</p>
  
  <p>First RedirectMatch line works for cities (single name):</p>
  
  <p>domain.com/music-classes-dallas-tx.html ===> domain.com/music-classes-in-dallas-tx.html</p>
  
  <p>Second RedirectMatch line works for states:</p>
  
  <p>domain.com/music-classes-texas.html ===> domain.com/music-classes-in-texas.html</p>
  
  <p>What I now need is for the RedirectMatch to work with city names that have 2-3 words. For example, The Colony TX or New Orleans LA. The code above doesn't catch these.</p>
  
  <p>Someone told me to use the below, but it's causing a redirect loop and throws in a bunch of in-in-in-in-in-in-in into the URL.</p>
  
  <pre><code>RedirectMatch 301 ^/([^-]+)-([^-]+)-(.+)-([^-]{2})\.html$ /$1-$2-in-$3-$4.html
  </code></pre>