title: How to redirect multiple files in same directory using nginx?
body: <p>We have a site built with WordPress with <code>nginx</code> web server. I want to do multiple redirection in one line of code in our <code>nginx</code> file.</p>
  
  <p>The code below runs smoothly:</p>
  
  <pre><code>location /wp-links-opml.php {
    return 301 https://$host/page-not-found;
  }
  </code></pre>
  
  <p>What I want to happen is redirect multiple files in just one config:</p>
  
  <pre><code>location /wp-links-opml.php /wp-config-sample.php /wp-load.php {
    return 301 https://$host/page-not-found;
  }
  </code></pre>
  
  <p>All of the files above belong in <code>root</code> directory but <code>nginx</code> prompts with <code>nginx exited with code 1</code></p>
  
  <p>Do you know how can I properly redirect multiple files in 1 config?</p>
  
  <p><strong>Note</strong>: I tried this <a href="https://stackoverflow.com/questions/35320674/how-can-i-have-same-rule-for-two-locations-in-nginx-config">How can I have same rule for two locations in NGINX config?</a> but in my case I am working with php files and not locations</p>
  
  <p>Any help is greatly appreciated. Thanks.</p>