Nginx rewriteurl from example.com/script.php?param=value to example.com/value
<p>I have a PHP script that accepts a single parameter.</p>

<p>My project structure is like the following:</p>

<pre><code>index.php
i.php
terms.php
functions
includes
icons
resources
</code></pre>

<p>The script that I want to rewrite its URL is <code>i.php</code> from</p>

<pre><code>example.com/i.php?icon=id
</code></pre>

<p>to</p>

<pre><code>example.com/id
</code></pre>

<p>While making sure everything else is normally accessible (e.g. <code>example.com/terms.php</code>).</p>

<p>How do I do that?</p>

<p><strong>Edit</strong>
This might be helpful. Here's my previous .htaccess that I used to use on my apache server:</p>

<pre><code>Options +FollowSymLinks  
RewriteEngine On  

RewriteCond %{SCRIPT_FILENAME} !-d  
RewriteCond %{SCRIPT_FILENAME} !-f  
RewriteRule ^(\w+)$ ./i.php?icon=$1
</code></pre>