In code, my real question is:

if(file_exists( c/ $requesturl ) 
serve( c/ $requesturl )
else
serve( index.php?blah )

In human form:

My script creates CSS. This really is pretty intensive, and so i built-in caching.

People request: http://domain.com/css/1lfi4wg.css2

That is rewritten:

RewriteRule ^([a-zA-Z0-9\-]*)\.css$  index.php?cssfilename=$1&generate

This works. Following the above is visited, a cachefile is produced, that also works:

http:// domain.com/css /c/ 1lfi4wg.css2

Now I wish to serve the produced file (/c/*) because the original request. Now i do that within the php file itself, however i guess carrying this out with htaccess is faster.

Now i have this which doesn't work:

RewriteCond %{DOCUMENT_ROOT}/c/%{REQUEST_FILENAME} -f
RewriteRule ^(.*)\.css$ %{DOCUMENT_ROOT}/c/$1.css [L]

REQUEST_FILENAME already is definitely an absolute file system path. Try the URI path in REQUEST_URI or even the matched up string from the RewriteRule pattern rather:

RewriteCond %{DOCUMENT_ROOT}/c%{REQUEST_URI} -f
RewriteRule ^.*\.css$ %{DOCUMENT_ROOT}/c%{REQUEST_URI} [L]
# OR
RewriteCond %{DOCUMENT_ROOT}/c/$0 -f
RewriteRule ^.*\.css$ %{DOCUMENT_ROOT}/c/$0 [L]