When should IIS redirect to a 404?
I have configured IIS to redirect to a custom 4开发者_高级运维04 page when a requested page is not found. However it is also redirecting to the 404 page if a resource such as a css, JavaScript or image file is not found. Is this what should happen?
Although a JS or CSS file should never be missing, it's possible a referenced image doesnt exist on the server as the site is managed using a CMS.
it is also redirecting to the 404 page if a resource such as a css, JavaScript or image file is not found. Is this what should happen?
Yes, it is.
If you are trying to access a resource (HTML, JS, images etc) that do not exist, a 404 is correct.
What shouldn't happen is a redirect of a page referencing such missing resources.
This behavior matches the definition
HTTP standard response code indicating that the client was able to communicate with the server, but the server could not find what was requested
精彩评论