Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

can anybody help me configure apache to do:

[[[>> configure apache2 to serve to 2-sites but but serve images from 1/same images directory <<]]]

my problem is where to best place the images directory so that the images are served by apache for both websites ie. from one same directory, and how to tell apache to do just that in the configuration file.

thank you.

share|improve this question

1 Answer 1

Use Alias See: http://httpd.apache.org/docs/current/mod/mod_alias.html#alias

NameVirtualHost *:80
<VirtualHost *:80>
    ServerName  www.example1.com
    Alias /images /var/www/common/images
    DocumentRoot /var/www/example1.com
<VirtualHost *:80>
    ServerName  www.example2.com
    Alias /images /var/www/common/images
    DocumentRoot /var/www/example2.com
share|improve this answer
thnank you Micrea. –  ali Dec 23 '10 at 20:36
i will use your solution now. but i did find a way to achieve my desired outcome by using a hard link with a -s flag, something like [ ln -s /imaged/directory/path/name name ] - but yours is probably the correct solution as a link may have security issues. again thank you very much. 3-cheers for server-fault : hip hip ... (PS. serverfault please use javascript to suppress this text form submitting on RETURN key press ). –  ali Dec 23 '10 at 20:44
ln -s will create a symbolic link. Linux does not allow directory hardlinks. You can achieve the same in NTFS with directory junctions. See: en.wikipedia.org/wiki/NTFS_junction_point –  Mircea Vutcovici Dec 23 '10 at 21:31

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.