I'd like to log the URLs that are requested but returning 404.
I've a php website served by IIS7. I've this in the web.config file to redirect urls that don't exist to the 404 page:
<httpErrors>
<remove statusCode="404" subStatusCode="-1" />
<error statusCode="404" prefixLanguageFilePath="" path="https://www.example.com/404.php" responseMode="Redirect" />
</httpErrors>
I've also:
<system.web>
<customErrors defaultRedirect="https://www.example.com/404.php" mode="On">
<error redirect="https://www.example.com/404.php" statusCode="404" />
</customErrors>
</system.web>
Everything I can find online says I can get the original URL requested from the php variable $_SERVER['REQUEST_URI'], but for me that always gives me 404.php.
Any idea how to get the original URL requested? The way my web.config is setup appears to stop the information being passed. If I could pass the original url as a get or post variable to the 404 page I'd be able to log it that way if that's possible?