title: How to remove a trailing question mark (empty query string) from the URL?
body: <p>Given an url such as <code>example.com/page?</code> I would like to strip the trailing question mark from the URL to avoid Google treating <code>example.com/page?</code> as a duplicate of <code>example.com/page</code>.</p>
  
  <p>Ideally, <code>example.com/page?</code> should return a 301 redirect to <code>example.com/page</code>. How can I accomplish this with Nginx?</p>
  
  <p>Thank you.</p>