Nginx rewrite not working with .php extension
<p>I'm trying to do a url rewrite via this code:</p>

<pre><code>location ~ /canada1/[A-Za-z0-9-_]+/.* {
        rewrite ^/canada1/([A-Za-z0-9-_]+)/.* /atemplates/weather/weather_forecast.php?region=$1&amp;location=$arg_db last;
}
</code></pre>

<p>With this url:</p>

<pre><code>/canada1/bc_british_columbia/weather.php?db=90
</code></pre>

<p>I've narrowed down the issue to the .php portion. Whatever I stick in there to replace it works fine as expected i.e. .phd .phq .abcdefg ... works fine. What do I need to do to make that thing rewrite with that .php extension?</p>

<p>Thanks for your help.</p>

<p>Reference: <a href="https://stackoverflow.com/questions/40064214/how-to-rewrite-old-url-with-a-period-question-mark-and-equals-in-it">How to rewrite old url with a period, question mark and equals in it?</a></p>