If I request a non-existant image on my site:
http://www.example.com/text.png
EE returns a 200 OK status code.
Is there anyway to return a 404 response?
This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.
The active forums are here.
February 15, 2011 11:35am
Subscribe [2]#1 / Feb 15, 2011 11:35am
If I request a non-existant image on my site:
http://www.example.com/text.png
EE returns a 200 OK status code.
Is there anyway to return a 404 response?
#2 / Feb 15, 2011 12:30pm
this is more an issue with how you have your .htaccess setup for URL rewriting.
#3 / Feb 15, 2011 12:35pm
I have added:
<FilesMatch "(\.jpe?g|gif|png|bmp|css|js|flv)$">
ErrorDocument 404 /404/index
</FilesMatch>To my .htaccess, and still get a 200?
#4 / Feb 15, 2011 12:48pm
Solved. Added:
<?
header( "HTTP/1.1 404 Not Found" );
exit;
?>To my 404 page.
#5 / Feb 15, 2011 2:21pm
Very glad to see that worked. Please don’t hesitate to post again as needed.