A web site I purchased has user uploads, and unfortunately they are not well organized for server speed. All 150,000 images are in same directory (Linux box). Naturally this adds substantial overhead to each image fetch.
What I want to do is make 100 sub-directories in the forum:
1
1/1
1/2
1/3
1/4
1/5
1/7
1/8
1/9
2/1
2/2
and so on.
All the files have a number in the first two digits of the filename. So I would place the files in the appropriate sub-directory using the first 2 digits, and then use a rewriterule so Apache can find it. I've banged my head against the wall trying to get rewriterules working.
Basically:
11ABCEFG.jpg would be rewritten to:
/1/1/1ABCEFG.jpg
94SJRDHEID.jpg would be rewritten to:
/9/4/94SJRDHEID.jpg
It should be simple, I've done a lot of work with mod-rewrite but this one is eluding me!