title: mod_rewrite convert: XXX-YYY to XXX.php?sub1=YYY
body: <p>i'm using an ubuntu LAMP and i'm trying to use mod_rewrite to convert url such as:</p>
  
  <ul>
  <li>site/XXX to site/XXX.php and</li>
  <li>site/XXX-YYY to site/XXX.php?sub1=YYY</li>
  </ul>
  
  <p>I've used this rewrite rules:</p>
  
  <pre><code>RewriteRule ^([a-zA-Z0-9]+)$ ./$1.php
  RewriteRule ^([a-zA-Z0-9]+)-([a-zA-Z0-9]+)$ ./$1.php?sub1=$2
  </code></pre>
  
  <p>In local on my OSX they works fine, anyway when uploaded the .htaccess on the ubuntu server, calling site/test i can't reach site/test.php but i get a 404.
  Mod_rewrite is working, in fact the 404 page is setted in the same .htaccess and works.
  In local i used this in a folder: localhost/myfolder/.... while in remote i'm using the root of a subdomain:
  app.sitename.com/....</p>
  
  <p>Can someone help me?</p>
  
  <p>This is the complete code:</p>
  
  <pre><code>RewriteEngine On
  RewriteRule ^altro&amp;(.+)? ./altro.php?$1 [L,QSA,NC]
  RewriteRule ^([a-zA-Z0-9]+)$ ./$1.php [L,QSA,NC]
  RewriteRule ^([a-zA-Z0-9]+)-([a-zA-Z0-9]+)$ ./$1.php?sub1=$2
  RewriteRule ^([a-zA-Z0-9]+)-([a-zA-Z0-9]+)-([a-zA-Z0-9]+)$ ./$1.php?sub1=$2&amp;sub2=$3
  RewriteRule ^([a-zA-Z0-9]+)-([a-zA-Z0-9]+)-([a-zA-Z0-9]+)-([a-zA-Z0-9]+)$ ./$1.php?sub1=$2&amp;sub2=$3&amp;sub3=$4
  RewriteRule ^([a-z]+)-([a-z]+)-([0-9]+)-([a-zA-Z0-9_]+).([a-zA-Z]+)$ ./server/php/files/$1/$2/$3/$4.$5
  </code></pre>
  
  <p>The first directive is working! In fact site/altro&amp;code opens altro.php?code</p>