Set X-PJAX-URL header to the redirect URL when applicable.

By the time a pjax request fails, the browser url has already been set to the failed URL, which is then sent as HTTP_REFERER in the fallback non-pjax request. This change prevents a possible redirect loop when the requested URL redirects back to HTTP_REFERER.