PHP $_SERVER['REQUEST_URI'] returning a 404'd file
<p>I'm having a strange issue here. </p>

<p>I'm setting a session variable to the value of <code>$_SERVER['REQUEST_URI']</code> on every page of my site except the login page. This way I can redirect the user back to whatever page they were on before logging in. </p>

<p>It works fine in every case, except recently I broke an image in my footer and the image <code>404</code>'s. Now, <code>$_SERVER['REQUEST_URI']</code> seems to be grabbing the URL of the image that's failing to load instead of the page the user was on, thus that my login form is now trying to redirect the user to the nonexistent image. </p>

<p>Obviously having files that fail to load is not ideal, but does anyone know why this server variable would be taking the value of the last failed request instead of the current page?</p>
