I've the next rewrite rules:

<IfModule mod_rewrite.c>
  RewriteEngine on
  RewriteBase /

  # Route requests to /media/* to /projects/media/*
  RewriteRule ^media/.* - [NC,L]

  # Route all URLs to dispatch.php.
  RewriteRule ^(.*)$ dispatch.php [L]
</IfModule>

This redirects everything to dispatch.php, unless of course the URL is example.com/media/* by which situation it'll search for the asked for file in ./media/. I'd like the URL /media/* to become rewritten to appear in project/media/*.

While using rewrite rule RewriteRule ^media/.* project/media [NC,L] leads to everything likely to dispatch.php.

You will need to capture the road and append it. For example:

RewriteRule ^media/(.*)$ project/media/$1 [NC,L]

Try these rules:

RewriteRule ^media/.* project/$0 [NC,L]
RewriteRule !^project/ dispatch.php [L]
RewriteEngine on
RewriteBase /
# Route requests to /media/* to /projects/media/*
RewriteRule ^media/(.*)$ project/media/$1 [L]
# Route all URLs to dispatch.php.
RewriteCond %{REQUEST_URI} !^/project/media/.*
RewriteRule ^(.*)$ maintenance.php [L]

Initially I needed to make use of the special %{IS_SUBREQ} variable, however i could not have it working.

Solution are available here.