Given this url:
and the following RewriteRule:
RewriteRule ([^/.]+)/?(.*) app/$1.php?$2
The requested URL /app/app.php was not found on this server.
RewriteRule ^([^/.]+)/?(.*) app/$1.php?$2
The problem is that the regex can match anywhere in the path string, and since the / is optional the result is unlikely to be what you want.
Also, make sure that you don't have multiple rewrite rules which apply, they will all get processed by default!