title: Write `.htaccess` regex to redirect URL to previous category/sub-directories
body: <p>I have a site at <strong>www.test.com</strong>. The site has many nested directories and categories such as <strong>www.test.com/cat/1/321/</strong>.</p>
  
  <p>I want to use a Regex to remove any url ending in <strong><code>/321/</code></strong> or <strong><code>/321</code></strong> to the previous category.</p>
  
  <p><strong>Example</strong>: Redirect <code>www.test.com/cat/1/321/</code>  to  <code>www.test.com/cat/1/</code></p>
  
  <p>Needed for a Wordpress site using <code>.htaccess</code>. Thanks!</p>