0

Is there a way to log 301 redirects returned by IIS with the (1) request Url and the (2) location Url of the response?

Something like this:

Url, Location

/about-us, /about
/old-page, /new-page

The IIS logs contain the Request Url and the status code (301), but not the location Url of the response. Ideally there would be an additional field in the IIS Log called Location that would be populated when IIS responded with a 301.

In my case the source of the redirect could be ISAPI Rewrite Rules, ASP.NET applications, Cold Fusion applications, or IIS itself. Perhaps there is a way to log IIS response data? Thanks for your help.

0

All ISAPI_Rewrite can have for this is [U]-flag. It allows you to see the original request, not a redirected already(which you see by default). However there's no way of creating this very customized type of log you've specified.

ISAPI_Rewrite has it's own logs(error.log and rewrite.log), but they are different and used for debugging purposes.

0

Well it's a little bit late as answer but maybe it would help.

In IIS 8.5, you can do that like this:

  1. Double click "Logging" in IIS Manager and make sure the server node is selected if you wanna apply this config to the whole server
  2. In "Log File section" go ahead and click "Select Fields..." button
  3. Click "Add Field..."
  4. In "Field Name" set the title you want, for me it was "Location"
  5. Select "Response Header" in source type combo
  6. Type "Location" in "Source" dropdown
  7. Go ahead and confirm both Forms and don't forget to set Apply in top-right corner

And Voilà!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.