Quantcast
Viewing all articles
Browse latest Browse all 2

Answer by Chris S for How do I use mod_rewite to use a cached copy of a page if available otherwise run a dynamic script?

Have the website point to the cache directory. Setup a rule that if a file doesn't exist rewrite to a "dynamic" source directory. The dynamic script would have to be responsible for writing to the cache directory as well (assuming you'd want it cached). Something else would have to be responsible for removing stale entries from the cache (cron job etc).

A better idea would be to put an actual caching reverse proxy in front of Apache. It's possible to use Apache as a reverse proxy, but there are better and more appropriate tools like nginx or varnish.


Viewing all articles
Browse latest Browse all 2

Trending Articles