Hello,
I want to write a rewrite rule for checking the existence of an image file.
If the file exists in the file system, so the user can open it. Else if the file doesn't exist nginx must give 410 error.
The following code seems doesn't work. Which mistake I did?
Thanks
P
location ~* \.(js|json|css|png|jpg|jpeg|gif|swf|xml|ico|csv)$ {
if (!-f $request_filename){
rewrite ^(.*)$ /image-not-found.html redirect;
}
}