user7429498
user7429498

Reputation:

Why Would Requesting a Nonexistent Image Generate a 302 Response Instead of 404?

I have a website and I have configured my main .htaccess file with this directive:

ErrorDocument 404 https://websiteLink.com

When I access a page that has a link to a nonexistent image, instead of receiving a the 404 above, I receive a 302 response with the location directive that specified in the .htaccess configuration.

Why this 302 response generated?

Upvotes: 0

Views: 176

Answers (1)

Amit Verma
Amit Verma

Reputation: 41219

This is because of the absolut url. You are using a full url in your ErrorDocument's destination. Use an absolute path

ErrorDocument 404 /path/

Upvotes: 1

Related Questions