We see quite a lot of posts in here about moving the filestore and why
it does not work if you just change the location in config.php, and
the answer is always 'you need a symlink' - but nobody ever says why!
The reason is quite simple. ResourceSpace uses two methods of
accessing resources - it reads and writes them as files, or it gives
the browser a URL and lets the client access them directly. If you go
into your gallery and look at the URL of an image, it will be
something like
http://www.mydomain.com/resourcespace/filestore/1/3/6_abcferdf/136src_123def456.jpg
Anybody who knows the filestore structure will realise that this is
resource ref 136, and they will see that I have made up the hash
strings. These strings are calculated using your scramble key (in
config.php) and are there to stop hackers from guessing your file
names. More important at present is the /filestore/ directory entry.
Obviously /filestore/ is picked up from your config, and you can
change it within config to anything you want, as long as it is under
the RS folder /resourcespace/ . If you move your filestore outside
the RS folder, it will still work as long as the URL makes sense and
as long as Apache can deliver content from that folder.
So if our RS app is in /var/www/apps/rs and our filestore is in /var/
www/data/rs/filestore, the config (which is a relative path) says
'../../data/rs/filestore', the URL says
http://www.mydomain.com/apps/rs/../../data/rs/filestore/1/3/6_abcferdf/136src_123def456.jpg
- and it should work, because you are still under the web root (/var/
www). This is messy though - even here, a symlink is recomended for
elegance.
The big problem arises when you put the filestore on another drive, a
nas or san, or a cloud. If our filestore is on /mnt/data/filestore,
the image cannot be delivered because it is not under the web root.
You may be able to set up Apache to include /mnt/data/filestore as a
virtual web root, but it's probably easier (and much cleaner) to
create a symlink.
So to answer the question, why do you need a symlink... you don't
need one, but it's just the best way to do it.