title: nginx regex redirect if specific string doesn't exist
body: <p>Right now I have a line redirecting anything ending in /amp/ to the URL with amp/ removed (since I installed an AMP plugin a while back and then deleted it and am now preventing 404s).</p>
  
  <p>Now I am installing AMP again but want to only have it functioning for pages that have /news/ within them like:</p>
  
  <p><a href="https://www.examplesite.com/news/name-of-article/" rel="nofollow noreferrer">https://www.examplesite.com/news/name-of-article/</a></p>
  
  <p>so if it has /news/ within the URL, it should allow /amp/ to work and not do a redirect:</p>
  
  <p><a href="https://www.examplesite.com/news/name-of-article/amp/" rel="nofollow noreferrer">https://www.examplesite.com/news/name-of-article/amp/</a></p>
  
  <p>If it doesn't have /news/ it shouldn't allow /amp/ and should remove /amp/ from the trailing end of the URL.</p>
  
  <p>Right now I have this in my config file to remove /amp/ at all times:</p>
  
  <p>rewrite ^(.*/)amp/$ $1 permanent;</p>
  
  <p>What would be the correct rewrite to make it work the new way and allow /amp/ if /news/ is found within the URL?</p>