In code, my question is:
if(file_exists( c/ $requesturl )
serve( c/ $requesturl )
else
serve( index.php?blah )
In human form:
My script generates CSS. This is pretty intensive, so I built in caching.
People request: http://domain.com/css/1lfi4wg.css2
Which is rewritten:
RewriteRule ^([a-zA-Z0-9\-]*)\.css$ index.php?cssfilename=$1&generate
This works. After the above is visited, a cachefile is generated, which also works:
http:// domain.com/css /c/ 1lfi4wg.css2
Now I want to serve the generated file (/c/*) as the original request. I now do this in the php file itself, but I guess doing this with htaccess is quicker.
I now have this which does not work:
RewriteCond %{DOCUMENT_ROOT}/c/%{REQUEST_FILENAME} -f
RewriteRule ^(.*)\.css$ %{DOCUMENT_ROOT}/c/$1.css [L]