<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><font face="arial, helvetica, sans-serif">That's because your fastcgi_split_path_info pattern does not match -<br>
.php is not followed by / in your rewritten url.<br>
<br>
Because of the location{} you are in, it is probably simplest to just<br>
replace the second capture part of that pattern with (.*)$.<br></font></blockquote><div><font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif">Thank you Francis. It worked after following your suggestions. </font></div><div><font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif">But I have found a different approach, that is working for all the cases that I tested. </font><span style="font-family:arial,helvetica,sans-serif">As per your suggestions, I have removed the if statement with try_files and have used the ~^ modifier to ensure that the location blocks get higher precedence than the regex block.</span></div><div><br></div><div><br></div><div><br></div><div><ol style="color:rgb(172,172,172);margin:0px;padding:0px 0px 0px 55px;font-family:Consolas,Menlo,Monaco,'Lucida Console','Liberation Mono','DejaVu Sans Mono','Bitstream Vera Sans Mono',monospace,serif;font-size:12px;line-height:24px;background:rgb(247,247,247)"><li style="margin-top:0px;margin-right:0px;margin-bottom:0px;background:rgb(255,255,255)"><div style="padding:0px 8px;vertical-align:top;color:rgb(51,51,51);border-left-width:1px;border-left-style:solid;border-left-color:rgb(221,221,221);margin-top:0px;margin-right:0px;margin-bottom:0px;background-image:initial;background-repeat:initial"><span>index</span> <span>index</span>.php<span style="color:rgb(102,204,102)">;</span></div></li><li style="margin-top:0px;margin-right:0px;margin-bottom:0px;background:rgb(255,255,255)"><div style="padding:0px 8px;vertical-align:top;color:rgb(51,51,51);border-left-width:1px;border-left-style:solid;border-left-color:rgb(221,221,221);margin-top:0px;margin-right:0px;margin-bottom:0px;background-image:initial;background-repeat:initial"> </div></li><li style="margin-top:0px;margin-right:0px;margin-bottom:0px;background:rgb(255,255,255)"><div style="padding:0px 8px;vertical-align:top;color:rgb(51,51,51);border-left-width:1px;border-left-style:solid;border-left-color:rgb(221,221,221);margin-top:0px;margin-right:0px;margin-bottom:0px;background-image:initial;background-repeat:initial"><span style="color:rgb(0,0,102)">location</span> <span style="color:rgb(102,204,102)">~</span> /\.ht <span style="color:rgb(102,204,102)">{</span></div></li><li style="margin-top:0px;margin-right:0px;margin-bottom:0px;background:rgb(255,255,255)"><div style="padding:0px 8px;vertical-align:top;color:rgb(51,51,51);border-left-width:1px;border-left-style:solid;border-left-color:rgb(221,221,221);margin-top:0px;margin-right:0px;margin-bottom:0px;background-image:initial;background-repeat:initial">    <span>deny</span> all<span style="color:rgb(102,204,102)">;</span></div></li><li style="margin-top:0px;margin-right:0px;margin-bottom:0px;background:rgb(255,255,255)"><div style="padding:0px 8px;vertical-align:top;color:rgb(51,51,51);border-left-width:1px;border-left-style:solid;border-left-color:rgb(221,221,221);margin-top:0px;margin-right:0px;margin-bottom:0px;background-image:initial;background-repeat:initial"><span style="color:rgb(102,204,102)">}</span></div></li><li style="margin-top:0px;margin-right:0px;margin-bottom:0px;background:rgb(255,255,255)"><div style="padding:0px 8px;vertical-align:top;color:rgb(51,51,51);border-left-width:1px;border-left-style:solid;border-left-color:rgb(221,221,221);margin-top:0px;margin-right:0px;margin-bottom:0px;background-image:initial;background-repeat:initial"> </div></li><li style="margin-top:0px;margin-right:0px;margin-bottom:0px;background:rgb(255,255,255)"><div style="padding:0px 8px;vertical-align:top;color:rgb(51,51,51);border-left-width:1px;border-left-style:solid;border-left-color:rgb(221,221,221);margin-top:0px;margin-right:0px;margin-bottom:0px;background-image:initial;background-repeat:initial"><span style="color:rgb(128,128,128);font-style:italic"># .php catchall regex block</span></div></li><li style="margin-top:0px;margin-right:0px;margin-bottom:0px;background:rgb(255,255,255)"><div style="padding:0px 8px;vertical-align:top;color:rgb(51,51,51);border-left-width:1px;border-left-style:solid;border-left-color:rgb(221,221,221);margin-top:0px;margin-right:0px;margin-bottom:0px;background-image:initial;background-repeat:initial"><span style="color:rgb(0,0,102)">location</span> <span style="color:rgb(102,204,102)">~</span> <span style="color:rgb(102,204,102)">[</span>^/<span style="color:rgb(102,204,102)">]</span>\.php$ <span style="color:rgb(102,204,102)">{</span></div></li><li style="margin-top:0px;margin-right:0px;margin-bottom:0px;background:rgb(255,255,255)"><div style="padding:0px 8px;vertical-align:top;color:rgb(51,51,51);border-left-width:1px;border-left-style:solid;border-left-color:rgb(221,221,221);margin-top:0px;margin-right:0px;margin-bottom:0px;background-image:initial;background-repeat:initial">    <span style="color:rgb(128,128,128);font-style:italic"># Handle .php uris, except when they are overridden below</span></div></li><li style="margin-top:0px;margin-right:0px;margin-bottom:0px;background:rgb(255,255,255)"><div style="padding:0px 8px;vertical-align:top;color:rgb(51,51,51);border-left-width:1px;border-left-style:solid;border-left-color:rgb(221,221,221);margin-top:0px;margin-right:0px;margin-bottom:0px;background-image:initial;background-repeat:initial">    <span style="color:rgb(177,177,0)">include</span> inc/php-fpm.conf<span style="color:rgb(102,204,102)">;</span></div></li><li style="margin-top:0px;margin-right:0px;margin-bottom:0px;background:rgb(255,255,255)"><div style="padding:0px 8px;vertical-align:top;color:rgb(51,51,51);border-left-width:1px;border-left-style:solid;border-left-color:rgb(221,221,221);margin-top:0px;margin-right:0px;margin-bottom:0px;background-image:initial;background-repeat:initial"><span style="color:rgb(102,204,102)">}</span></div></li><li style="margin-top:0px;margin-right:0px;margin-bottom:0px;background:rgb(255,255,255)"><div style="padding:0px 8px;vertical-align:top;color:rgb(51,51,51);border-left-width:1px;border-left-style:solid;border-left-color:rgb(221,221,221);margin-top:0px;margin-right:0px;margin-bottom:0px;background-image:initial;background-repeat:initial"> </div></li><li style="margin-top:0px;margin-right:0px;margin-bottom:0px;background:rgb(255,255,255)"><div style="padding:0px 8px;vertical-align:top;color:rgb(51,51,51);border-left-width:1px;border-left-style:solid;border-left-color:rgb(221,221,221);margin-top:0px;margin-right:0px;margin-bottom:0px;background-image:initial;background-repeat:initial"><span style="color:rgb(0,0,102)">location</span> / <span style="color:rgb(102,204,102)">{</span></div></li><li style="margin-top:0px;margin-right:0px;margin-bottom:0px;background:rgb(255,255,255)"><div style="padding:0px 8px;vertical-align:top;color:rgb(51,51,51);border-left-width:1px;border-left-style:solid;border-left-color:rgb(221,221,221);margin-top:0px;margin-right:0px;margin-bottom:0px;background-image:initial;background-repeat:initial">    <span>if</span> <span style="color:rgb(102,204,102)">(</span><span style="color:rgb(0,0,102)">$request_uri</span> <span style="color:rgb(102,204,102)">~</span> <span style="color:rgb(255,0,0)">"^[^?]*?//"</span><span style="color:rgb(102,204,102)">)</span> <span style="color:rgb(102,204,102)">{</span></div></li><li style="margin-top:0px;margin-right:0px;margin-bottom:0px;background:rgb(255,255,255)"><div style="padding:0px 8px;vertical-align:top;color:rgb(51,51,51);border-left-width:1px;border-left-style:solid;border-left-color:rgb(221,221,221);margin-top:0px;margin-right:0px;margin-bottom:0px;background-image:initial;background-repeat:initial">        <span style="color:rgb(128,128,128);font-style:italic"># Remove double slashes from url</span></div></li><li style="margin-top:0px;margin-right:0px;margin-bottom:0px;background:rgb(255,255,255)"><div style="padding:0px 8px;vertical-align:top;color:rgb(51,51,51);border-left-width:1px;border-left-style:solid;border-left-color:rgb(221,221,221);margin-top:0px;margin-right:0px;margin-bottom:0px;background-image:initial;background-repeat:initial">        <span>rewrite</span> <span style="color:rgb(255,0,0)">"^"</span> <span style="color:rgb(0,0,102)">$scheme</span>://<span style="color:rgb(0,0,102)">$host</span><span style="color:rgb(0,0,102)">$uri</span> permanent<span style="color:rgb(102,204,102)">;</span></div></li><li style="margin-top:0px;margin-right:0px;margin-bottom:0px;background:rgb(255,255,255)"><div style="padding:0px 8px;vertical-align:top;color:rgb(51,51,51);border-left-width:1px;border-left-style:solid;border-left-color:rgb(221,221,221);margin-top:0px;margin-right:0px;margin-bottom:0px;background-image:initial;background-repeat:initial">    <span style="color:rgb(102,204,102)">}</span></div></li><li style="margin-top:0px;margin-right:0px;margin-bottom:0px;background:rgb(255,255,255)"><div style="padding:0px 8px;vertical-align:top;color:rgb(51,51,51);border-left-width:1px;border-left-style:solid;border-left-color:rgb(221,221,221);margin-top:0px;margin-right:0px;margin-bottom:0px;background-image:initial;background-repeat:initial">   </div></li><li style="margin-top:0px;margin-right:0px;margin-bottom:0px;background:rgb(255,255,255)"><div style="padding:0px 8px;vertical-align:top;color:rgb(51,51,51);border-left-width:1px;border-left-style:solid;border-left-color:rgb(221,221,221);margin-top:0px;margin-right:0px;margin-bottom:0px;background-image:initial;background-repeat:initial">    <span style="color:rgb(128,128,128);font-style:italic"># Handle non .php files and directory indexes</span></div></li><li style="margin-top:0px;margin-right:0px;margin-bottom:0px;background:rgb(255,255,255)"><div style="padding:0px 8px;vertical-align:top;color:rgb(51,51,51);border-left-width:1px;border-left-style:solid;border-left-color:rgb(221,221,221);margin-top:0px;margin-right:0px;margin-bottom:0px;background-image:initial;background-repeat:initial">    <span style="color:rgb(0,0,102)">try_files</span> <span style="color:rgb(0,0,102)">$uri</span> <span style="color:rgb(0,0,102)">$uri</span>/<span>index</span>.php<span style="color:rgb(102,204,102)">;</span></div></li><li style="margin-top:0px;margin-right:0px;margin-bottom:0px;background:rgb(255,255,255)"><div style="padding:0px 8px;vertical-align:top;color:rgb(51,51,51);border-left-width:1px;border-left-style:solid;border-left-color:rgb(221,221,221);margin-top:0px;margin-right:0px;margin-bottom:0px;background-image:initial;background-repeat:initial"><span style="color:rgb(102,204,102)">}</span></div></li><li style="margin-top:0px;margin-right:0px;margin-bottom:0px;background:rgb(255,255,255)"><div style="padding:0px 8px;vertical-align:top;color:rgb(51,51,51);border-left-width:1px;border-left-style:solid;border-left-color:rgb(221,221,221);margin-top:0px;margin-right:0px;margin-bottom:0px;background-image:initial;background-repeat:initial"> </div></li><li style="margin-top:0px;margin-right:0px;margin-bottom:0px;background:rgb(255,255,255)"><div style="padding:0px 8px;vertical-align:top;color:rgb(51,51,51);border-left-width:1px;border-left-style:solid;border-left-color:rgb(221,221,221);margin-top:0px;margin-right:0px;margin-bottom:0px;background-image:initial;background-repeat:initial"><span style="color:rgb(0,0,102)">location</span>  /generated/imgs/ <span style="color:rgb(102,204,102)">{</span></div></li><li style="margin-top:0px;margin-right:0px;margin-bottom:0px;background:rgb(255,255,255)"><div style="padding:0px 8px;vertical-align:top;color:rgb(51,51,51);border-left-width:1px;border-left-style:solid;border-left-color:rgb(221,221,221);margin-top:0px;margin-right:0px;margin-bottom:0px;background-image:initial;background-repeat:initial">    <span style="color:rgb(128,128,128);font-style:italic"># Serve file if it exists, else use rewriting (for dynamically generated and cached files)</span></div></li><li style="margin-top:0px;margin-right:0px;margin-bottom:0px;background:rgb(255,255,255)"><div style="padding:0px 8px;vertical-align:top;color:rgb(51,51,51);border-left-width:1px;border-left-style:solid;border-left-color:rgb(221,221,221);margin-top:0px;margin-right:0px;margin-bottom:0px;background-image:initial;background-repeat:initial">    <span style="color:rgb(128,128,128);font-style:italic"># This ensures that rewrite rules are not applied to existing files</span></div></li><li style="margin-top:0px;margin-right:0px;margin-bottom:0px;background:rgb(255,255,255)"><div style="padding:0px 8px;vertical-align:top;color:rgb(51,51,51);border-left-width:1px;border-left-style:solid;border-left-color:rgb(221,221,221);margin-top:0px;margin-right:0px;margin-bottom:0px;background-image:initial;background-repeat:initial">    <span style="color:rgb(0,0,102)">try_files</span> <span style="color:rgb(0,0,102)">$uri</span> <span style="color:rgb(0,0,102)">@rewrite_generated_imgs</span><span style="color:rgb(102,204,102)">;</span></div></li><li style="margin-top:0px;margin-right:0px;margin-bottom:0px;background:rgb(255,255,255)"><div style="padding:0px 8px;vertical-align:top;color:rgb(51,51,51);border-left-width:1px;border-left-style:solid;border-left-color:rgb(221,221,221);margin-top:0px;margin-right:0px;margin-bottom:0px;background-image:initial;background-repeat:initial"><span style="color:rgb(102,204,102)">}</span></div></li><li style="margin-top:0px;margin-right:0px;margin-bottom:0px;background:rgb(255,255,255)"><div style="padding:0px 8px;vertical-align:top;color:rgb(51,51,51);border-left-width:1px;border-left-style:solid;border-left-color:rgb(221,221,221);margin-top:0px;margin-right:0px;margin-bottom:0px;background-image:initial;background-repeat:initial"> </div></li><li style="margin-top:0px;margin-right:0px;margin-bottom:0px;background:rgb(255,255,255)"><div style="padding:0px 8px;vertical-align:top;color:rgb(51,51,51);border-left-width:1px;border-left-style:solid;border-left-color:rgb(221,221,221);margin-top:0px;margin-right:0px;margin-bottom:0px;background-image:initial;background-repeat:initial"><span style="color:rgb(0,0,102)">location</span>  <span style="color:rgb(0,0,102)">@rewrite_generated_imgs</span> <span style="color:rgb(102,204,102)">{</span></div></li><li style="margin-top:0px;margin-right:0px;margin-bottom:0px;background:rgb(255,255,255)"><div style="padding:0px 8px;vertical-align:top;color:rgb(51,51,51);border-left-width:1px;border-left-style:solid;border-left-color:rgb(221,221,221);margin-top:0px;margin-right:0px;margin-bottom:0px;background-image:initial;background-repeat:initial">    <span style="color:rgb(128,128,128);font-style:italic"># Since extension is changed from .jpg to .php, use last.</span></div></li><li style="margin-top:0px;margin-right:0px;margin-bottom:0px;background:rgb(255,255,255)"><div style="padding:0px 8px;vertical-align:top;color:rgb(51,51,51);border-left-width:1px;border-left-style:solid;border-left-color:rgb(221,221,221);margin-top:0px;margin-right:0px;margin-bottom:0px;background-image:initial;background-repeat:initial">    <span style="color:rgb(128,128,128);font-style:italic"># This will pass the rewritten uri to the .php regex block for execution</span></div></li><li style="margin-top:0px;margin-right:0px;margin-bottom:0px;background:rgb(255,255,255)"><div style="padding:0px 8px;vertical-align:top;color:rgb(51,51,51);border-left-width:1px;border-left-style:solid;border-left-color:rgb(221,221,221);margin-top:0px;margin-right:0px;margin-bottom:0px;background-image:initial;background-repeat:initial">   </div></li><li style="margin-top:0px;margin-right:0px;margin-bottom:0px;background:rgb(255,255,255)"><div style="padding:0px 8px;vertical-align:top;color:rgb(51,51,51);border-left-width:1px;border-left-style:solid;border-left-color:rgb(221,221,221);margin-top:0px;margin-right:0px;margin-bottom:0px;background-image:initial;background-repeat:initial">    <span>rewrite</span> <span style="color:rgb(255,0,0)">"^/generated/imgs/([0-9]+)/(.*).jpg$"</span> /generated/imgs/pic.php?width<span style="color:rgb(102,204,102)">=</span>$1&height<span style="color:rgb(102,204,102)">=</span>$1&pic<span style="color:rgb(102,204,102)">=</span>$2&mode<span style="color:rgb(102,204,102)">=</span>proportionate last<span style="color:rgb(102,204,102)">;</span></div></li><li style="margin-top:0px;margin-right:0px;margin-bottom:0px;background:rgb(255,255,255)"><div style="padding:0px 8px;vertical-align:top;color:rgb(51,51,51);border-left-width:1px;border-left-style:solid;border-left-color:rgb(221,221,221);margin-top:0px;margin-right:0px;margin-bottom:0px;background-image:initial;background-repeat:initial">    <span>rewrite</span> <span style="color:rgb(255,0,0)">"^/generated/imgs/([0-9]+)x([0-9]+)/(.*).jpg$"</span> /generated/imgs/pic.php?width<span style="color:rgb(102,204,102)">=</span>$1&height<span style="color:rgb(102,204,102)">=</span>$2&pic<span style="color:rgb(102,204,102)">=</span>$3&mode<span style="color:rgb(102,204,102)">=</span>exact last<span style="color:rgb(102,204,102)">;</span></div></li><li style="margin-top:0px;margin-right:0px;margin-bottom:0px;background:rgb(255,255,255)"><div style="padding:0px 8px;vertical-align:top;color:rgb(51,51,51);border-left-width:1px;border-left-style:solid;border-left-color:rgb(221,221,221);margin-top:0px;margin-right:0px;margin-bottom:0px;background-image:initial;background-repeat:initial"> </div></li><li style="margin-top:0px;margin-right:0px;margin-bottom:0px;background:rgb(255,255,255)"><div style="padding:0px 8px;vertical-align:top;color:rgb(51,51,51);border-left-width:1px;border-left-style:solid;border-left-color:rgb(221,221,221);margin-top:0px;margin-right:0px;margin-bottom:0px;background-image:initial;background-repeat:initial">    <span style="color:rgb(0,0,102)">try_files</span> <span style="color:rgb(0,0,102)">$uri</span> <span style="color:rgb(0,0,102)">$uri</span>/<span>index</span>.php<span style="color:rgb(102,204,102)">;</span></div></li><li style="margin-top:0px;margin-right:0px;margin-bottom:0px;background:rgb(255,255,255)"><div style="padding:0px 8px;vertical-align:top;color:rgb(51,51,51);border-left-width:1px;border-left-style:solid;border-left-color:rgb(221,221,221);margin-top:0px;margin-right:0px;margin-bottom:0px;background-image:initial;background-repeat:initial"><span style="color:rgb(102,204,102)">}</span></div></li><li style="margin-top:0px;margin-right:0px;margin-bottom:0px;background:rgb(255,255,255)"><div style="padding:0px 8px;vertical-align:top;color:rgb(51,51,51);border-left-width:1px;border-left-style:solid;border-left-color:rgb(221,221,221);margin-top:0px;margin-right:0px;margin-bottom:0px;background-image:initial;background-repeat:initial"> </div></li><li style="margin-top:0px;margin-right:0px;margin-bottom:0px;background:rgb(255,255,255)"><div style="padding:0px 8px;vertical-align:top;color:rgb(51,51,51);border-left-width:1px;border-left-style:solid;border-left-color:rgb(221,221,221);margin-top:0px;margin-right:0px;margin-bottom:0px;background-image:initial;background-repeat:initial"><span style="color:rgb(128,128,128);font-style:italic"># The ^~ modifier ensures that .php uris are not caught by the .php catchall regex block</span></div></li><li style="margin-top:0px;margin-right:0px;margin-bottom:0px;background:rgb(255,255,255)"><div style="padding:0px 8px;vertical-align:top;color:rgb(51,51,51);border-left-width:1px;border-left-style:solid;border-left-color:rgb(221,221,221);margin-top:0px;margin-right:0px;margin-bottom:0px;background-image:initial;background-repeat:initial"><span style="color:rgb(0,0,102)">location</span> ^<span style="color:rgb(102,204,102)">~</span> /banking/ <span style="color:rgb(102,204,102)">{</span></div></li><li style="margin-top:0px;margin-right:0px;margin-bottom:0px;background:rgb(255,255,255)"><div style="padding:0px 8px;vertical-align:top;color:rgb(51,51,51);border-left-width:1px;border-left-style:solid;border-left-color:rgb(221,221,221);margin-top:0px;margin-right:0px;margin-bottom:0px;background-image:initial;background-repeat:initial">    <span>rewrite</span> <span style="color:rgb(255,0,0)">"^/banking/sitemap-(<span style="color:rgb(0,0,153);font-weight:bold">\d</span>+).xml.gz$"</span> /banking/sitemap-generator.php?id<span style="color:rgb(102,204,102)">=</span>$1 last<span style="color:rgb(102,204,102)">;</span></div></li><li style="margin-top:0px;margin-right:0px;margin-bottom:0px;background:rgb(255,255,255)"><div style="padding:0px 8px;vertical-align:top;color:rgb(51,51,51);border-left-width:1px;border-left-style:solid;border-left-color:rgb(221,221,221);margin-top:0px;margin-right:0px;margin-bottom:0px;background-image:initial;background-repeat:initial"> </div></li><li style="margin-top:0px;margin-right:0px;margin-bottom:0px;background:rgb(255,255,255)"><div style="padding:0px 8px;vertical-align:top;color:rgb(51,51,51);border-left-width:1px;border-left-style:solid;border-left-color:rgb(221,221,221);margin-top:0px;margin-right:0px;margin-bottom:0px;background-image:initial;background-repeat:initial">    <span style="color:rgb(0,0,102)">try_files</span> <span style="color:rgb(0,0,102)">$uri</span> <span style="color:rgb(0,0,102)">$uri</span>/<span>index</span>.php<span style="color:rgb(102,204,102)">;</span></div></li><li style="margin-top:0px;margin-right:0px;margin-bottom:0px;background:rgb(255,255,255)"><div style="padding:0px 8px;vertical-align:top;color:rgb(51,51,51);border-left-width:1px;border-left-style:solid;border-left-color:rgb(221,221,221);margin-top:0px;margin-right:0px;margin-bottom:0px;background-image:initial;background-repeat:initial"> </div></li><li style="margin-top:0px;margin-right:0px;margin-bottom:0px;background:rgb(255,255,255)"><div style="padding:0px 8px;vertical-align:top;color:rgb(51,51,51);border-left-width:1px;border-left-style:solid;border-left-color:rgb(221,221,221);margin-top:0px;margin-right:0px;margin-bottom:0px;background-image:initial;background-repeat:initial">    <span style="color:rgb(0,0,102)">location</span> <span style="color:rgb(102,204,102)">~</span> <span style="color:rgb(102,204,102)">[</span>^/<span style="color:rgb(102,204,102)">]</span>\.php$ <span style="color:rgb(102,204,102)">{</span></div></li><li style="margin-top:0px;margin-right:0px;margin-bottom:0px;background:rgb(255,255,255)"><div style="padding:0px 8px;vertical-align:top;color:rgb(51,51,51);border-left-width:1px;border-left-style:solid;border-left-color:rgb(221,221,221);margin-top:0px;margin-right:0px;margin-bottom:0px;background-image:initial;background-repeat:initial">        <span>rewrite</span> <span style="color:rgb(255,0,0)">"^/banking/([A-Za-z0-9-]+)/branches.php$"</span> /banking/branches.php?name<span style="color:rgb(102,204,102)">=</span>$1 <span>break</span><span style="color:rgb(102,204,102)">;</span></div></li><li style="margin-top:0px;margin-right:0px;margin-bottom:0px;background:rgb(255,255,255)"><div style="padding:0px 8px;vertical-align:top;color:rgb(51,51,51);border-left-width:1px;border-left-style:solid;border-left-color:rgb(221,221,221);margin-top:0px;margin-right:0px;margin-bottom:0px;background-image:initial;background-repeat:initial">        <span>rewrite</span> <span style="color:rgb(255,0,0)">"^/banking/([A-Za-z0-9-]+)/atm.php$"</span> /banking/atm.php?name<span style="color:rgb(102,204,102)">=</span>$1 <span>break</span><span style="color:rgb(102,204,102)">;</span></div></li><li style="margin-top:0px;margin-right:0px;margin-bottom:0px;background:rgb(255,255,255)"><div style="padding:0px 8px;vertical-align:top;color:rgb(51,51,51);border-left-width:1px;border-left-style:solid;border-left-color:rgb(221,221,221);margin-top:0px;margin-right:0px;margin-bottom:0px;background-image:initial;background-repeat:initial">       </div></li><li style="margin-top:0px;margin-right:0px;margin-bottom:0px;background:rgb(255,255,255)"><div style="padding:0px 8px;vertical-align:top;color:rgb(51,51,51);border-left-width:1px;border-left-style:solid;border-left-color:rgb(221,221,221);margin-top:0px;margin-right:0px;margin-bottom:0px;background-image:initial;background-repeat:initial">        <span style="color:rgb(177,177,0)">include</span> inc/php-fpm.conf<span style="color:rgb(102,204,102)">;</span></div></li><li style="margin-top:0px;margin-right:0px;margin-bottom:0px;background:rgb(255,255,255)"><div style="padding:0px 8px;vertical-align:top;color:rgb(51,51,51);border-left-width:1px;border-left-style:solid;border-left-color:rgb(221,221,221);margin-top:0px;margin-right:0px;margin-bottom:0px;background-image:initial;background-repeat:initial">    <span style="color:rgb(102,204,102)">}</span></div></li><li style="margin-top:0px;margin-right:0px;margin-bottom:0px;background:rgb(255,255,255)"><div style="padding:0px 8px;vertical-align:top;color:rgb(51,51,51);border-left-width:1px;border-left-style:solid;border-left-color:rgb(221,221,221);margin-top:0px;margin-right:0px;margin-bottom:0px;background-image:initial;background-repeat:initial"><span style="color:rgb(102,204,102)">}</span></div></li><li style="margin-top:0px;margin-right:0px;margin-bottom:0px;background:rgb(255,255,255)"><div style="padding:0px 8px;vertical-align:top;color:rgb(51,51,51);border-left-width:1px;border-left-style:solid;border-left-color:rgb(221,221,221);margin-top:0px;margin-right:0px;margin-bottom:0px;background-image:initial;background-repeat:initial"> </div></li><li style="margin-top:0px;margin-right:0px;margin-bottom:0px;background:rgb(255,255,255)"><div style="padding:0px 8px;vertical-align:top;color:rgb(51,51,51);border-left-width:1px;border-left-style:solid;border-left-color:rgb(221,221,221);margin-top:0px;margin-right:0px;margin-bottom:0px;background-image:initial;background-repeat:initial"><span style="color:rgb(0,0,102)">location</span>  ^<span style="color:rgb(102,204,102)">~</span> /news/ <span style="color:rgb(102,204,102)">{</span></div></li><li style="margin-top:0px;margin-right:0px;margin-bottom:0px;background:rgb(255,255,255)"><div style="padding:0px 8px;vertical-align:top;color:rgb(51,51,51);border-left-width:1px;border-left-style:solid;border-left-color:rgb(221,221,221);margin-top:0px;margin-right:0px;margin-bottom:0px;background-image:initial;background-repeat:initial">    <span style="color:rgb(128,128,128);font-style:italic"># Check for file before applying rewrite rules. If not, rewrite</span></div></li><li style="margin-top:0px;margin-right:0px;margin-bottom:0px;background:rgb(255,255,255)"><div style="padding:0px 8px;vertical-align:top;color:rgb(51,51,51);border-left-width:1px;border-left-style:solid;border-left-color:rgb(221,221,221);margin-top:0px;margin-right:0px;margin-bottom:0px;background-image:initial;background-repeat:initial">    <span style="color:rgb(128,128,128);font-style:italic"># This ensures that rewrite rules are not applied to existing files</span></div></li><li style="margin-top:0px;margin-right:0px;margin-bottom:0px;background:rgb(255,255,255)"><div style="padding:0px 8px;vertical-align:top;color:rgb(51,51,51);border-left-width:1px;border-left-style:solid;border-left-color:rgb(221,221,221);margin-top:0px;margin-right:0px;margin-bottom:0px;background-image:initial;background-repeat:initial">    <span style="color:rgb(0,0,102)">try_files</span> <span style="color:rgb(0,0,102)">$uri</span> <span style="color:rgb(0,0,102)">$uri</span>/<span>index</span>.php <span style="color:rgb(0,0,102)">@rewrite_news</span><span style="color:rgb(102,204,102)">;</span></div></li><li style="margin-top:0px;margin-right:0px;margin-bottom:0px;background:rgb(255,255,255)"><div style="padding:0px 8px;vertical-align:top;color:rgb(51,51,51);border-left-width:1px;border-left-style:solid;border-left-color:rgb(221,221,221);margin-top:0px;margin-right:0px;margin-bottom:0px;background-image:initial;background-repeat:initial"><span style="color:rgb(102,204,102)">}</span></div></li><li style="margin-top:0px;margin-right:0px;margin-bottom:0px;background:rgb(255,255,255)"><div style="padding:0px 8px;vertical-align:top;color:rgb(51,51,51);border-left-width:1px;border-left-style:solid;border-left-color:rgb(221,221,221);margin-top:0px;margin-right:0px;margin-bottom:0px;background-image:initial;background-repeat:initial"> </div></li><li style="margin-top:0px;margin-right:0px;margin-bottom:0px;background:rgb(255,255,255)"><div style="padding:0px 8px;vertical-align:top;color:rgb(51,51,51);border-left-width:1px;border-left-style:solid;border-left-color:rgb(221,221,221);margin-top:0px;margin-right:0px;margin-bottom:0px;background-image:initial;background-repeat:initial"><span style="color:rgb(0,0,102)">location</span> <span style="color:rgb(0,0,102)">@rewrite_news</span> <span style="color:rgb(102,204,102)">{</span></div></li><li style="margin-top:0px;margin-right:0px;margin-bottom:0px;background:rgb(255,255,255)"><div style="padding:0px 8px;vertical-align:top;color:rgb(51,51,51);border-left-width:1px;border-left-style:solid;border-left-color:rgb(221,221,221);margin-top:0px;margin-right:0px;margin-bottom:0px;background-image:initial;background-repeat:initial">    <span style="color:rgb(128,128,128);font-style:italic"># Rewrite non PHP urls in outer location block.</span></div></li><li style="margin-top:0px;margin-right:0px;margin-bottom:0px;background:rgb(255,255,255)"><div style="padding:0px 8px;vertical-align:top;color:rgb(51,51,51);border-left-width:1px;border-left-style:solid;border-left-color:rgb(221,221,221);margin-top:0px;margin-right:0px;margin-bottom:0px;background-image:initial;background-repeat:initial">    <span style="color:rgb(128,128,128);font-style:italic"># Use last so that it will be passed to the .php regex block after rewrite.</span></div></li><li style="margin-top:0px;margin-right:0px;margin-bottom:0px;background:rgb(255,255,255)"><div style="padding:0px 8px;vertical-align:top;color:rgb(51,51,51);border-left-width:1px;border-left-style:solid;border-left-color:rgb(221,221,221);margin-top:0px;margin-right:0px;margin-bottom:0px;background-image:initial;background-repeat:initial">    <span style="color:rgb(128,128,128);font-style:italic"># This ensures that the php code is executed and not downloaded as is</span></div></li><li style="margin-top:0px;margin-right:0px;margin-bottom:0px;background:rgb(255,255,255)"><div style="padding:0px 8px;vertical-align:top;color:rgb(51,51,51);border-left-width:1px;border-left-style:solid;border-left-color:rgb(221,221,221);margin-top:0px;margin-right:0px;margin-bottom:0px;background-image:initial;background-repeat:initial">   </div></li><li style="margin-top:0px;margin-right:0px;margin-bottom:0px;background:rgb(255,255,255)"><div style="padding:0px 8px;vertical-align:top;color:rgb(51,51,51);border-left-width:1px;border-left-style:solid;border-left-color:rgb(221,221,221);margin-top:0px;margin-right:0px;margin-bottom:0px;background-image:initial;background-repeat:initial">    <span>rewrite</span> <span style="color:rgb(255,0,0)">"^/news/articles/?$"</span> /news/ permanent<span style="color:rgb(102,204,102)">;</span></div></li><li style="margin-top:0px;margin-right:0px;margin-bottom:0px;background:rgb(255,255,255)"><div style="padding:0px 8px;vertical-align:top;color:rgb(51,51,51);border-left-width:1px;border-left-style:solid;border-left-color:rgb(221,221,221);margin-top:0px;margin-right:0px;margin-bottom:0px;background-image:initial;background-repeat:initial">    <span>rewrite</span> <span style="color:rgb(255,0,0)">"^/news/articles/a([0-9]+)<span style="color:rgb(0,0,153);font-weight:bold">\.</span>html$"</span> /news/article.php?id<span style="color:rgb(102,204,102)">=</span>$1&mode<span style="color:rgb(102,204,102)">=</span>article last<span style="color:rgb(102,204,102)">;</span></div></li><li style="margin-top:0px;margin-right:0px;margin-bottom:0px;background:rgb(255,255,255)"><div style="padding:0px 8px;vertical-align:top;color:rgb(51,51,51);border-left-width:1px;border-left-style:solid;border-left-color:rgb(221,221,221);margin-top:0px;margin-right:0px;margin-bottom:0px;background-image:initial;background-repeat:initial">    <span>rewrite</span> <span style="color:rgb(255,0,0)">"^/news/page-([0-9]+)<span style="color:rgb(0,0,153);font-weight:bold">\.</span>html$"</span> /news/<span>index</span>.php?cat<span style="color:rgb(102,204,102)">=</span>home&page<span style="color:rgb(102,204,102)">=</span>$1 last<span style="color:rgb(102,204,102)">;</span></div></li><li style="margin-top:0px;margin-right:0px;margin-bottom:0px;background:rgb(255,255,255)"><div style="padding:0px 8px;vertical-align:top;color:rgb(51,51,51);border-left-width:1px;border-left-style:solid;border-left-color:rgb(221,221,221);margin-top:0px;margin-right:0px;margin-bottom:0px;background-image:initial;background-repeat:initial">    <span>rewrite</span> <span style="color:rgb(255,0,0)">"^/news/([a-z-]+)/rss.xml$"</span> /news/rss/$1.xml <span>break</span><span style="color:rgb(102,204,102)">;</span></div></li><li style="margin-top:0px;margin-right:0px;margin-bottom:0px;background:rgb(255,255,255)"><div style="padding:0px 8px;vertical-align:top;color:rgb(51,51,51);border-left-width:1px;border-left-style:solid;border-left-color:rgb(221,221,221);margin-top:0px;margin-right:0px;margin-bottom:0px;background-image:initial;background-repeat:initial"> </div></li><li style="margin-top:0px;margin-right:0px;margin-bottom:0px;background:rgb(255,255,255)"><div style="padding:0px 8px;vertical-align:top;color:rgb(51,51,51);border-left-width:1px;border-left-style:solid;border-left-color:rgb(221,221,221);margin-top:0px;margin-right:0px;margin-bottom:0px;background-image:initial;background-repeat:initial">    <span style="color:rgb(0,0,102)">try_files</span> <span style="color:rgb(0,0,102)">$uri</span> <span style="color:rgb(0,0,102)">$uri</span>/<span>index</span>.php<span style="color:rgb(102,204,102)">;</span></div></li><li style="margin-top:0px;margin-right:0px;margin-bottom:0px;background:rgb(255,255,255)"><div style="padding:0px 8px;vertical-align:top;color:rgb(51,51,51);border-left-width:1px;border-left-style:solid;border-left-color:rgb(221,221,221);margin-top:0px;margin-right:0px;margin-bottom:0px;background-image:initial;background-repeat:initial"> </div></li><li style="margin-top:0px;margin-right:0px;margin-bottom:0px;background:rgb(255,255,255)"><div style="padding:0px 8px;vertical-align:top;color:rgb(51,51,51);border-left-width:1px;border-left-style:solid;border-left-color:rgb(221,221,221);margin-top:0px;margin-right:0px;margin-bottom:0px;background-image:initial;background-repeat:initial">    <span style="color:rgb(0,0,102)">location</span> <span style="color:rgb(102,204,102)">~</span> <span style="color:rgb(102,204,102)">[</span>^/<span style="color:rgb(102,204,102)">]</span>\.php$ <span style="color:rgb(102,204,102)">{</span></div></li><li style="margin-top:0px;margin-right:0px;margin-bottom:0px;background:rgb(255,255,255)"><div style="padding:0px 8px;vertical-align:top;color:rgb(51,51,51);border-left-width:1px;border-left-style:solid;border-left-color:rgb(221,221,221);margin-top:0px;margin-right:0px;margin-bottom:0px;background-image:initial;background-repeat:initial">        <span style="color:rgb(128,128,128);font-style:italic"># Rewrite PHP urls</span></div></li><li style="margin-top:0px;margin-right:0px;margin-bottom:0px;background:rgb(255,255,255)"><div style="padding:0px 8px;vertical-align:top;color:rgb(51,51,51);border-left-width:1px;border-left-style:solid;border-left-color:rgb(221,221,221);margin-top:0px;margin-right:0px;margin-bottom:0px;background-image:initial;background-repeat:initial">        <span style="color:rgb(128,128,128);font-style:italic"># Use break so that the rewrite rules are not applied again</span></div></li><li style="margin-top:0px;margin-right:0px;margin-bottom:0px;background:rgb(255,255,255)"><div style="padding:0px 8px;vertical-align:top;color:rgb(51,51,51);border-left-width:1px;border-left-style:solid;border-left-color:rgb(221,221,221);margin-top:0px;margin-right:0px;margin-bottom:0px;background-image:initial;background-repeat:initial">       </div></li><li style="margin-top:0px;margin-right:0px;margin-bottom:0px;background:rgb(255,255,255)"><div style="padding:0px 8px;vertical-align:top;color:rgb(51,51,51);border-left-width:1px;border-left-style:solid;border-left-color:rgb(221,221,221);margin-top:0px;margin-right:0px;margin-bottom:0px;background-image:initial;background-repeat:initial">        <span>rewrite</span> <span style="color:rgb(255,0,0)">"^/news/print.php$"</span> /news/article.php?mode<span style="color:rgb(102,204,102)">=</span>print <span>break</span><span style="color:rgb(102,204,102)">;</span></div></li><li style="margin-top:0px;margin-right:0px;margin-bottom:0px;background:rgb(255,255,255)"><div style="padding:0px 8px;vertical-align:top;color:rgb(51,51,51);border-left-width:1px;border-left-style:solid;border-left-color:rgb(221,221,221);margin-top:0px;margin-right:0px;margin-bottom:0px;background-image:initial;background-repeat:initial"> </div></li><li style="margin-top:0px;margin-right:0px;margin-bottom:0px;background:rgb(255,255,255)"><div style="padding:0px 8px;vertical-align:top;color:rgb(51,51,51);border-left-width:1px;border-left-style:solid;border-left-color:rgb(221,221,221);margin-top:0px;margin-right:0px;margin-bottom:0px;background-image:initial;background-repeat:initial">        <span style="color:rgb(177,177,0)">include</span> inc/php-fpm.conf<span style="color:rgb(102,204,102)">;</span></div></li><li style="margin-top:0px;margin-right:0px;margin-bottom:0px;background:rgb(255,255,255)"><div style="padding:0px 8px;vertical-align:top;color:rgb(51,51,51);border-left-width:1px;border-left-style:solid;border-left-color:rgb(221,221,221);margin-top:0px;margin-right:0px;margin-bottom:0px;background-image:initial;background-repeat:initial">    <span style="color:rgb(102,204,102)">}</span></div></li><li style="margin-top:0px;margin-right:0px;margin-bottom:0px;background:rgb(255,255,255)"><div style="padding:0px 8px;vertical-align:top;color:rgb(51,51,51);border-left-width:1px;border-left-style:solid;border-left-color:rgb(221,221,221);margin-top:0px;margin-right:0px;margin-bottom:0px;background-image:initial;background-repeat:initial"><span style="color:rgb(102,204,102)">}</span></div></li><li style="margin-top:0px;margin-right:0px;margin-bottom:0px;background:rgb(255,255,255)"><div style="padding:0px 8px;vertical-align:top;color:rgb(51,51,51);border-left-width:1px;border-left-style:solid;border-left-color:rgb(221,221,221);margin-top:0px;margin-right:0px;margin-bottom:0px;background-image:initial;background-repeat:initial"> </div></li><li style="margin-top:0px;margin-right:0px;margin-bottom:0px;background:rgb(255,255,255)"><div style="padding:0px 8px;vertical-align:top;color:rgb(51,51,51);border-left-width:1px;border-left-style:solid;border-left-color:rgb(221,221,221);margin-top:0px;margin-right:0px;margin-bottom:0px;background-image:initial;background-repeat:initial"><span style="color:rgb(102,204,102)">================</span></div></li><li style="margin-top:0px;margin-right:0px;margin-bottom:0px;background:rgb(255,255,255)"><div style="padding:0px 8px;vertical-align:top;color:rgb(51,51,51);border-left-width:1px;border-left-style:solid;border-left-color:rgb(221,221,221);margin-top:0px;margin-right:0px;margin-bottom:0px;background-image:initial;background-repeat:initial"># inc/php-fpm.conf</div></li><li style="margin-top:0px;margin-right:0px;margin-bottom:0px;background:rgb(255,255,255)"><div style="padding:0px 8px;vertical-align:top;color:rgb(51,51,51);border-left-width:1px;border-left-style:solid;border-left-color:rgb(221,221,221);margin-top:0px;margin-right:0px;margin-bottom:0px;background-image:initial;background-repeat:initial"> </div></li><li style="margin-top:0px;margin-right:0px;margin-bottom:0px;background:rgb(255,255,255)"><div style="padding:0px 8px;vertical-align:top;color:rgb(51,51,51);border-left-width:1px;border-left-style:solid;border-left-color:rgb(221,221,221);margin-top:0px;margin-right:0px;margin-bottom:0px;background-image:initial;background-repeat:initial"><span style="color:rgb(128,128,128);font-style:italic"># /cms/cms.php is the fallback script that will handle all missing uris</span></div></li><li style="margin-top:0px;margin-right:0px;margin-bottom:0px;background:rgb(255,255,255)"><div style="padding:0px 8px;vertical-align:top;color:rgb(51,51,51);border-left-width:1px;border-left-style:solid;border-left-color:rgb(221,221,221);margin-top:0px;margin-right:0px;margin-bottom:0px;background-image:initial;background-repeat:initial"><span style="color:rgb(0,0,102)">try_files</span> <span style="color:rgb(0,0,102)">$uri</span> /cms/cms.php <span style="color:rgb(102,204,102)">=</span><span>404</span><span style="color:rgb(102,204,102)">;</span></div></li><li style="margin-top:0px;margin-right:0px;margin-bottom:0px;background:rgb(255,255,255)"><div style="padding:0px 8px;vertical-align:top;color:rgb(51,51,51);border-left-width:1px;border-left-style:solid;border-left-color:rgb(221,221,221);margin-top:0px;margin-right:0px;margin-bottom:0px;background-image:initial;background-repeat:initial"> </div></li><li style="margin-top:0px;margin-right:0px;margin-bottom:0px;background:rgb(255,255,255)"><div style="padding:0px 8px;vertical-align:top;color:rgb(51,51,51);border-left-width:1px;border-left-style:solid;border-left-color:rgb(221,221,221);margin-top:0px;margin-right:0px;margin-bottom:0px;background-image:initial;background-repeat:initial"><span>fastcgi_pass</span> <a href="http://127.0.0.1">127.0.0.1</a>:<span>9000</span><span style="color:rgb(102,204,102)">;</span></div></li><li style="margin-top:0px;margin-right:0px;margin-bottom:0px;background:rgb(255,255,255)"><div style="padding:0px 8px;vertical-align:top;color:rgb(51,51,51);border-left-width:1px;border-left-style:solid;border-left-color:rgb(221,221,221);margin-top:0px;margin-right:0px;margin-bottom:0px;background-image:initial;background-repeat:initial"><span>fastcgi_index</span> <span>index</span>.php<span style="color:rgb(102,204,102)">;</span></div></li><li style="margin-top:0px;margin-right:0px;margin-bottom:0px;background:rgb(255,255,255)"><div style="padding:0px 8px;vertical-align:top;color:rgb(51,51,51);border-left-width:1px;border-left-style:solid;border-left-color:rgb(221,221,221);margin-top:0px;margin-right:0px;margin-bottom:0px;background:rgb(248,248,248)"><span style="color:rgb(177,177,0)">include</span> fastcgi_params<span style="color:rgb(102,204,102)">;</span></div></li></ol></div><div><br></div><div><br></div><div>Does this look fine? Is it a bad idea to use named locations like this?</div><div> </div></div></div></div>