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

I have two websites hosted on one server. The rootpath is:

  1. /public_html
  2. /public_html/2ndsite

I have uploaded the files of 2nd site to /public_html/2ndsite. It is working.

Now, I have a images folder(thousands of images) at public_html/images. I want to make this folder available at /public_html/2ndsite. I have tried "../images/image.gif", but doesn't work.

Whenever a image is inserted in first site, I would like to have that inserted in 2nd site also. Can I access the 1st site images in 2nd site withut using the URL (like www.site.com/images) as the image url shuld be "../images/image.gif" (images are inserted in 2nd site also, so in database I am storing this format.)

share|improve this question
    
Please add a tag saying what web server you mean - it looks like Apache, but you'll need to explicitly say this before you get meaningful responses. Also edit your message title to say it too. –  Jimmy Shelter Dec 13 '09 at 19:21
    
How are you using these images? with a server side executable (PHP, ASP, Python, Rails, etc.) or with a web browser? –  Richard Slater Dec 13 '09 at 19:30
add comment

1 Answer

I'm going to attempt to interpret your question from your stream of consciousness:

"I have two websites hosted on one server. I want them to have separate content directories except for /images which should be shared between the two domains."

What you should do is:

  1. Put the content for site1.domain.com into .../public_html/site1.domain.com
  2. Put the content for site2.domain.com into .../public_html/site2.domain.com
  3. Put the images into .../public_html/common_images

Then, create a symlink from .../public_html/site1.domain.com/images and .../public_html/site1.domain.com/images to .../public_html/common_images.

Now, whenever you access http://siteX.domain.com/images, you'll be served content out of the .../public_html/common_images directory.

Make sure that you tell your webserver to allow symlinks and content to be served from .../public_html/common_images.

share|improve this answer
add comment

Your Answer

 
discard

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