htaccess rewrite language string from subfolder to file
===

I'm having trouble rewriting the subfolder back to the file. 

**The redirect works but not the last rule.**


Here's what I'm trying to do: 

`domain.com/file.php?lang=fr`  

would like to rewrite it back to 

`domain.com/fr/file.php`

no matter what folder the files are in.


I'm only using one language which is french.
    

    RewriteCond %{QUERY_STRING} ^lang=([A-Za-z-]+)/?$ 
    RewriteRule ^(.*)\.php$ %1/$1.php?  [NS,R=301,L] 
    RewriteRule ^fr/(.*)\.php/?$ $1.php?lang=fr&redirect=no [QSA,L]