I have a caching program that creates static html files of dynamically generated php files. I currently use php to check if the cached version exists, if it does I serve it up and php exits. As in this question (http://stackoverflow.com/questions/5612735/using-mod-rewrite-to-view-cached-version-from-usual-url), I feel this is a waste of time. However, I have around 5,000 pages and as such, I would prefer not to place them all in the same /cache/ directory. I would instead like to place
/a-web-url/ in /cache/a/a-web-url.html.gz
and
/this-is-another-url/ in /cache/t/this-is-another-url.html.gz
I am currently working with
RewriteRule ^([A-Za-z0-9-_/\.]+)/$ /cache/$1
However this assumes that all are in the same directory. I would prefer them to be divided into subdirectories. Thanks.
Also note that all of my files end in .html.gz
Use rule