To extend @Pierre.Vriens answer , you could then add a rewrite rule to make the urls a bit nicer
assumptions
- you've got public files set up
- you've got a url 'normalisation' (either symlinks in files directory or 301s)
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /sites/%{HTTP_HOST}/files/$1 [L]
in your host will take
http://www.example.com/filename.pdf
and rewrite it to
http://www.example.com/sites/www.example.com/files/filename.pdf
what do i mean by url normalisation ?
well, if you can get example.com - then you'll get a 404 - as the folder in the sites directory is www.example.com
an easy solution is to use symlinks in the sites directory, or to use 301 redirects
to use symlinks, assume you have
sites/www.example.com
you could then create a symlink to it as follows
ln -s www.example.com example.com
this would create a symbolic link from
sites/example.com
to the www.example.com folder. this means that both www.example.com, and example.com would be found when the rewrite rule runs