title: How to know why a 301 redirect occurred in a PHP application in IIS?
body: <p>IIS logging has logged that a specific GET request as been redirected.</p>
  <p>Here is the relevant entry (ip address removed):</p>
  <p><code>2021-10-06 02:48:59 xx.xx.xx.xx GET /test - 80 - xx.xxx.x.xxx Mozilla/5.0+(Windows+NT+6.1;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/93.0.4577.82+Safari/537.36 - 301 0 0 1</code></p>
  <p>The application <code>/test</code> consists of a single index.php file that <code>echo</code>'s the word 'hello'.</p>
  <p>There are no url redirect rules set up in IIS. Nor are there any calls to  <code>header()</code></p>
  <p>Any ideas as to how to determine why a redirect would occur on a simple web application like this? Or tips on how one can find out the cause?</p>
  <p>For context, the server which this simple application runs on sits behind an AWS load balancer. However, the redirect definitely is occuring on the IIS server and not in some firewall or network configuration.</p>
  <p>Additionally, the redirect only occurs when there is no &quot;/&quot; on the end. If there is a &quot;/&quot; on the end, it works. (status code = 200). I have more detailed info in this question <a href="https://stackoverflow.com/questions/69400179/aws-php-https-website-redirects-to-http-when-there-is-no-slash-at-the-end">here</a></p>