views:

68

answers:

3

Dear all,

I got 2 sub-domains

c:\wamp\www\websiteA\ - http://websiteA/

c:\wamp\www\websiteB\ - http://websiteB/

inside websiteA got a folder for storing picture

c:\wamp\www\websiteA\photos\

in order websiteB want to access websiteA photo in websiteB's html I have to do link like

url: http://websiteB/1.html

<img src="http://websiteA/photos/1.jpg" />

the problem is I don't want to expose websiteA domain in websiteB, since two domain is inside one machine. Is it possible to achieve something like virtual host?

I also don't want to expose the physical path for websiteA, and don't want to duplicate the data.

I am thinking do something in websiteB .htaccess?

My goal is in websiteB html able to display photo with it own domain,

<img src="http://websiteB/photos/1.jpg" />

Edit: I think the question ask it this way is better in order user request http://websiteB/photo/1.jpg, the backend actually request the file from http://websiteA/photo/1.jpg, any idea do from .htaccess?

I am new in htaccess, I tried in .htaccess, but not success

RewriteEngine On
RewriteRule http://websiteA/photos/1.jpg http://websiteB/photos/1.jpg[NC,L]

Many Thanks!!!

PS: Solution need to work either windows / linux environment.

A: 

On Windows it depends on what filesystem you're using. NTFS: http://en.wikipedia.org/wiki/NTFS_symbolic_link FAT32 doesn't support symlinks.

Andrew Kolesnikov
sry for my fault, my solution need to work with windows and linux environment. my hosting plan is under linux.
Shiro
A: 

Sound doggy? Can you supply reason?

What you are probably looking for is a proxy. Check it out on google

TFD
no really for proxy.I just don't want websiteB get photo in websiteA, since the photo is in the same machine, I am sure websiteB can get websiteA contain, but I don't want expose websiteA link.I am thinking .htaccess should able to do that. I update my title is better
Shiro
A: 

I think I got my solution, not sure is perfect or not inside .htaccess for websiteB

RewriteEngine On
RewriteBase /websiteB/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^photos/(.*)$ http://websiteA/$1 [L]

the thing I found it not so perfect is when I enter http://websiteB/photos/1.jpg, it will redirect to http://websiteA/photos/1.jpg

but inside the HTML, I type

<img src="http://websiteB/photos/1.jpg" />

It able to load http://websiteA/photos/1.jpg without change the URL. That's look OK for me.

Shiro