0

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.)

2
  • 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. Dec 13, 2009 at 19:21
  • How are you using these images? with a server side executable (PHP, ASP, Python, Rails, etc.) or with a web browser? Dec 13, 2009 at 19:30

1 Answer 1

1

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.

You must log in to answer this question.