title: Nginx: Remove part of the url
body: <p>I'm looking for the right rewrite rule for my Nginx server. I would like to remove a specific part of the URL.</p>
  
  <p>An Example:</p>
  
  <p>example.com/assets/files   <em>-- the real location</em></p>
  
  <p>to</p>
  
  <p>example.com/files  </p>
  
  <p>and</p>
  
  <p>example.com/assets/files/image.jpg</p>
  
  <p>to</p>
  
  <p>example.com/files/image.jpg</p>
  
  <p>and</p>
  
  <p>example.com/assets/themes/css/style.css</p>
  
  <p>to</p>
  
  <p>example.com/themes/css/style.css</p>
  
  <p>I have googled it, but none of the salutations I found worked for me. I just got some 500 errors.</p>
  
  <p>So what rewrite rule do I need and where should I put it in my conf file. Thank you!</p>