nginx regex configuration for 404 images

Posted by Muhammet Arslan on Server Fault See other posts from Server Fault or by Muhammet Arslan
Published on 2014-08-19T13:32:53Z Indexed on 2014/08/20 10:23 UTC
Read the original article Hit count: 372

Filed under:
|

I have dynamic link series like below;

http://example.com/users/1871233/18712443_cover.jpg

Only static thing is on that link is example.com/users and _cover.I want to make that ; when requested is not found return a jpg

location ~ ^\/users\/(.*)\/(.*)_cover.*(jpg|jpeg|png|gif)$ {
        error_page 404 /deff_images/empty-cover-jpg.jpg;
}

I did smt like above but not worked .

What can i do for that ? So thanks

© Server Fault or respective owner

Related posts about nginx

Related posts about regex