I have an ugly, "just make it work" version of the rewrite rules that I am trying to simplify, but no luck.
You can look at my working rewrite, and the one that doesn't work here https://gist.github.com/920669
This is what I am trying to achieve:
- when http://hostname/img/123456.jpg is requested:
1. do an internal rewrite to /repository/images/1/2/3/123456.jpg
2. if /repository/images/1/2/3/123456.jpg does not exist rewrite to /api/image.php?filename=123456.jpg and pass this uri to the proxy
3. if it exists, set expires max; headers and deliver the file
Thanks!