Msg#: 4472370 posted 1:55 am on Jul 4, 2012 (gmt 0)
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.
11ABCEFG.jpg would be rewritten to:
94SJRDHEID.jpg would be rewritten to:
It should be simple, I've done a lot of work with mod-rewrite but this one is eluding me!
Msg#: 4472370 posted 7:54 am on Jul 4, 2012 (gmt 0)
Do you have a doodad that will automatically shove all new uploads into the appropriate directory? If you don't change the physical file structure, you still have a directory containing 1,5 lakhs of files; no combination of Rewrites and Redirects will change that.
Are the image files directly accessible by name, as in image-hosting sites, or can they only be called by pages? If they're not human-accessible, there's no need for a Rewrite. html pages don't know from pretty URLs.