title: htaccess mod_rewrite rules combination issue
body: <p>I'm so newbie in apache, so it's a basic question but I couldn't solve this using another questions or links.
  <br>
  I tried to change my <code>URL</code> using <code>.htaccess</code> and I had two purposes;</p>
  
  <ol>
  <li>hide <strong><code>.php</code></strong> extension</li>
  <li>change some queryString from <strong><em><code>somefile.php?id=bar</code></em></strong> to <code>somefile/id/bar</code> which <code>bar</code> is a number or mixed string like <strong><code>T51-3</code></strong>.
  <br>
  My queryString is <code>http://localhost/payment/theme/ticket?id=770314</code> that I want change it to <strong><em><code>http://localhost/payment/theme/ticket/id/770314</code></em></strong> or
  <br>
  <strong><em><code>http://localhost/payment/theme/ticket/770314</code></em></strong>
  <br><br></li>
  </ol>
  
  <p>I found this code:</p>
  
  <pre><code>Options +FollowSymLinks -MultiViews
  # Turn mod_rewrite on
  RewriteEngine On
  RewriteBase /
  
  # To externally redirect /dir/foo.php to /dir/foo
  RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s([^.]+)\.php [NC]
  RewriteRule ^ %1 [R,L,NC]
  
  
  ## To internally redirect /dir/foo to /dir/foo.php
  RewriteCond %{REQUEST_FILENAME}.php -f [NC]
  RewriteRule ^ %{REQUEST_URI}.php [L]
  </code></pre>
  
  <p><br>
  in <a href="https://stackoverflow.com/questions/10028025/how-can-i-use-htaccess-to-hide-php-url-extensions">stackoverflow.com/this_question</a>
  <br><br></p>
  
  <p>This was working nice but didn't solve my second issue.
  <br>
  So, I searched for a while in this site and others and did find some sample codes like this one :
  <br></p>
  
  <pre><code>RewriteRule ^([a-zA-Z0-9_-]+)-([0-9]+)$ ticket.php?id=$2
  </code></pre>
  
  <p>or</p>
  
  <pre><code>RewriteRule ^(.*)$ /ticket.php?url=$1 [L]
  </code></pre>
  
  <p>and etc...</p>
  
  <p>but none of these didn't work for me.
  <br>
  Some of them will make the server done and some don't have any affect at all.
  Would you please guide me to right way...
  <br>
  I looked at these questions:
  <br>
  <a href="https://stackoverflow.com/questions/1231067/htaccess-rewrite-for-query-string">htaccess rewrite for query string</a>
  <br></p>
  
  <p><a href="https://stackoverflow.com/questions/28392487/how-to-change-query-string-parameters-with-name-using-htaccess">how to change query string parameters with name using .htaccess?</a>
  <br></p>
  
  <p><a href="https://stackoverflow.com/questions/10028025/how-can-i-use-htaccess-to-hide-php-url-extensions">How can I use .htaccess to hide .php URL extensions?</a></p>
  
  <p>And these links:
  <br>
  <a href="http://simonecarletti.com/blog/2009/01/apache-query-string-redirects/" rel="nofollow noreferrer">http://simonecarletti.com/blog/2009/01/apache-query-string-redirects/</a>
  <br>
  <a href="https://wiki.apache.org/httpd/RewriteQueryString" rel="nofollow noreferrer">https://wiki.apache.org/httpd/RewriteQueryString</a></p>
  
  <p><strong><em>UPDATE :</em></strong>
  <br>
  This is my site strucure:
  <a href="https://i.stack.imgur.com/QYPDy.gif" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/QYPDy.gif" alt="site structure"></a>
  <br>
  There is an htaccess for important folders, like, <code>forms</code>, <code>db</code>, <code>classes</code> etc...
  <br>
  All my site pages are in the <code>theme</code> folder, as you can see in the picture.
  <br>
  In the root htaccess, there's just two lines that auto start sessions.
  <br><br>
  And I added your code to theme's htaccess.
  <br>
  <strong><em><code>Thanks in Advance</code></em></strong></p>