Silex 404 / htaccess - app / src / www结构

Here is the URL I want : http://localhost/project/api/ and the error is :

Sorry, the page you are looking for could not be found.

My structure, and I have 2 htaccess in api et api/www :

- project
-- api
--- app
--- src
--- www

The project/api/ :

<IfModule mod_rewrite.c>
# project/api/.htaccess
RewriteEngine On

RewriteBase /project/api/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ www/$1 [QSA,L]
</IfModule>

The project/api/www htaccess :

<IfModule mod_rewrite.c>
# project/api/www/.htaccess
Options -MultiViews

RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ app.php [L]
</IfModule>

For RewriteBase I tried to append /project/api/www/ but it didn't work too.

When the URL is http://localhost/justwrite/api/www/ I get my 'hello world'

EDIT : Here is my project/api/www/app.php :

<?php
require_once __DIR__.'/../../vendor/autoload.php';

$app = new Silex\Application();
echo 'test';
$app->get('/', function () {
    return 'Hello ';
});

$app->run();

The weird thing is "test" appear with the URL http://localhost/project/api/.

EDIT 2: If I put :

$app->get('project/api/', function () {
    return new Response('Welcome');
});

'Welcome' is showed maybe there is a parameter I can set in Silex to have this syntax : $app->get('/', ...) ?

I have found rewrite rules to be cumbursome. They end up working but somehow it always takes some fighting. In this case there is an alternative: FallbackResource. If your version of apache is 2.2.16 or higher you can replace the rewrite rules the code below. Add this to your two .htaccess file (one in each folder):

# silex rewrite rule
DirectoryIndex /app.php
FallbackResource /app.php

Replace app.php by the silex php file.