I am using rewrite like this
if (!-e $request_filename) {
rewrite ^/(en|ga)?/?(.*)$ /index2.php?cultureKey=$1&mq=$2 last;
}
but after I need certain rewritten URLs to be cached for 30 seconds. Remaining fast_cgi requests should be 5 minutes.
fastcgi_cache_valid 200 302 5m;
expires 5m;
if ($args ~* (dynamic\.html)){
expires 30s;
}
I have tried moving those around, but either both dynamic.html and other files are still cached after 30 seconds or they both expire after 30.
How to make dynamic.html (rewritten) cached for 30s and remaining files for 5m?
thanks
$args
is a variable containing the request parameters on aGET
, are you sure you are not after$request_uri
or$uri
? Maybe using a location block is better:but it depends on the rest of your config so YMMV.
I think it is 'if' what causing problems. You should read this http://wiki.nginx.org/IfIsEvil