Hi, I'm having problems with setting up a rewrite.
I basically want any POSTs or cache misses to go to index.php
My biggest problem is I want to parse an ID from the url and check if it exists in the cache
[code]
if ($uri ~* "([0-9]+).*") {
rewrite ([0-9]+).* /cache/$1.html;
break;
}
[/code]
not really sure how to check if it exists before rewriting.
here's my full location block:
[code]
location / {
index index.php;
if ($request_method = POST) {
rewrite ^(.*)$ /index.php last;
break;
}
if (-f $document_root/cache/$uri/index.html) {
rewrite (.*) /cache/$1/index.html;
break;
}
if (-f $document_root/cache/$uri) {
rewrite (.*) /cache/$1;
break;
}
if ($uri ~* "([0-9]+).*") {
rewrite ([0-9]+).* /cache/$1.html;
break;
}
if (!-f $request_filename) {
rewrite ^(.*)$ /index.php last;
break;
}
if (!-d $request_filename) {
rewrite ^(.*)$ /index.php last;
break;
}
}
[/code]