# If statements, string manipulation and file detection

**URL:** <https://www.ruby-forum.com/t/if-statements-string-manipulation-and-file-detection/245846>\
**Category:** NGINX\
**Created:** [July 18, 2013, 8:50pm UTC](https://www.ruby-forum.com/t/if-statements-string-manipulation-and-file-detection/245846 "2013-07-18T20:50:28Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sadaf\_N](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/858c86/32.png) [@Sadaf\_N](https://www.ruby-forum.com/u/Sadaf_N)\
**Post date:** [July 18, 2013, 8:50pm UTC](https://www.ruby-forum.com/t/if-statements-string-manipulation-and-file-detection/245846/1 "2013-07-18T20:50:28Z")

</div>

Hi, I’d like to use some if statements in a config. I know if in nginx  
is  
evil, but I think it’s what I want. Here is the pseudo-nginx-conf-code  
for  
what I need: [http://pastebin.com/BxrtZ695](http://pastebin.com/BxrtZ695) — can someone please help me  
get  
the syntax right? In english, the idea is: if the requested filename  
ends  
with either “F.jpg” or “M.jpg”, and another file with almost the same  
name  
but the _other_ ending instead does not exist, break/fail.

Thanks for any help!

Posted at Nginx Forum:

> **[If statements, string manipulation and file detection](https://forum.nginx.org/read.php?2,241010,241010#msg-241010)**
>
> Hi, I'd like to use some if statements in a config. I know if in nginx is evil, but I think it's what I want. Here is the pseudo-nginx-conf-code for what I need: http://pastebin.com/BxrtZ695 — can someone please help me get the syntax right? In...
