title: Rewrite rule challenge in nginx
body: <p>I have this old URL from our previous site</p>
  
  <p><a href="http://site.com/fixed-word/changing-category/12345-title-of-story" rel="nofollow">http://site.com/fixed-word/changing-category/12345-title-of-story</a></p>
  
  <p>where the "variables" are</p>
  
  <p>changing-category: example sports, politics etc.</p>
  
  <p>and</p>
  
  <p>12345-title-of-story: 12345 is the old id and the rest is the story slug / title</p>
  
  <p>The new site uses only the story slug in this format</p>
  
  <p><a href="http://site.com/another-fixed-word/title-of-story" rel="nofollow">http://site.com/another-fixed-word/title-of-story</a></p>
  
  <p>Is it possible to create a 301 rewrite rule in nginx to achieve this ?</p>
  
  <p>I tried this:</p>
  
  <p>rewrite ^/fixed-word/([^\?]+)$/([^\?]+)$ /index.php?tipo=old_article&amp;slug=$1 last;</p>
  
  <p>And the idea was to get the slug in php and remove the numeric id from the slug (12345-) but does not work, aging returns 404</p>
  
  <p>Any advice ?</p>
  
  <p>Thanks</p>