title: 301 Redirect with nginx
body: <p>I moved my website URLs from this form:</p>
  <pre><code>https://example.com/category/sub-category/post-url
  https://example.com/category/post-url
  </code></pre>
  <p>to this form:</p>
  <pre><code>https://example.com/post-url
  </code></pre>
  <p>And I would like to set up nginx redirection so that I don't lose the visitors going through old URLs.</p>
  <p>I have found the regex that I need to use, which is simply <code>([^\/]+$)</code> (Takes all text after the last slash). But how can I set it up to use with nginx?</p>