title: Control S3 Bucket Hosted Website's trailing slash redirects
body: <p>Automated the deployment of static sites to S3 with Ansible - not using any of Ansible's built in tools, necessarily, just using the CLI and local commands.</p>
  
  <p>It's been working really well, but one issue I can't shake is when creating redirects, visiting the redirect with a trailing slash gives a 404, because S3 looks to serve /redirect/index.html rather than following the redirect.</p>
  
  <p>Redirects are created through the API:</p>
  
  <pre><code>aws s3api put-object 
    --acl public-read 
    --website-redirect-location "https://devicelab.org/" 
    --key html/book
  </code></pre>
  
  <p>...where 'html' is the folder configured to serve the website from, 'book' is the desired redirect, and the homepage is the desired destination.</p>
  
  <p>Visiting <a href="https://devicelab.org/book" rel="nofollow noreferrer">https://devicelab.org/book</a> behaves as expected. Visiting <a href="https://devicelab.org/book/" rel="nofollow noreferrer">https://devicelab.org/book/</a> (note trailing slash) shows 404 page.</p>
  
  <p>I've tried creating an additional object <code>html/book/</code> (with trailing slash) but still get the 404.</p>
  
  <p>How can I configure this behaviour / work around the issue?</p>