The path to a folder on the server without calling the domain name

Sounds a bit strange that title, but let me explain.

We have a main site which holds all the pics of our hotels, and there are thousands of them.

We are in the process of building a new site, on the same server but inside a different folder.

I have worked out the path and its


../../checksafetyfirst/en/admin1212/imgdata/hotel<?=$rows['foto1']

Here is the html code and php.


<a href="hotel.php?Id_Hot=<?=$rows['hotel_id']?>&amp;Id=<?=$hlist?>&amp;selectCountry=<?=$rows['country_id']?>&amp;selectRegion=<?=$rows['region_id']?>" class="bodySmall1">
<?php
$path = '../../checksafetyfirst/en'.$row['address'].'/';
$realpath = str_replace("#", "%23", $path);
?>
<img class="HomeFeaturedImages" src="<?php echo $realpath; ?>admin1212/imgdata/hotel<?=$rows['foto1']?>" alt="<?=$rows['hotel_name']?>" height="80" width="80" border="0"/></a>

Again the image isnt being drawn out, and when i right click on the image and look at the path, its using the domain name which means its starts from the folder where the domain name is directed.

But when i click on the image and look at the path, it is drawing out the domain name of the site im developing, rather than simply going back through the folder structure to the root level and then down to the image folder I want to draw the images out of.

So what I get instead is this.

http://www.mysite.co.uk/checksafetyfirst/en/admin1212/imgdata/hotel/imgdata/hotel/7914ShamsImpJul1.jpg

So what I want it to do, is ignore the domain name, and then start its fall from the root level through the checksafetyfirst folder.

Hopefully that makes sense.

Cheers

So you have a domain name pointing to a subdirectory of your main domain’s directory? And the images you need are not below the new domains subdirectory? You can’t use …/ to get above your root directory of your new domain.

You may beable to create a symlink in your new subdirectory to map to the images in your existing website.

Hi r2d2, ye thats right.

Right I see, so that explains the sub directory domain name being pulled out.

Your spot on though.

I have trimmed the html code back again:

<a href=“hotel.php?Id_Hot=<?=$rows[‘hotel_id’]?>&Id=<?=$hlist?>&selectCountry=<?=$rows[‘country_id’]?>&selectRegion=<?=$rows[‘region_id’]?>” class=“bodySmall1”>
<img class=“HomeFeaturedImages” src=“admin1212/imgdata/hotel<?=$rows[‘foto1’]?>” alt=“<?=$rows[‘hotel_name’]?>” height=“80” width=“80” border=“0”/></a>

So will have a look at that symlink as you suggested.

OK have had a look and it seems straight forward enough, and use it as below, and something is wrong because the page stops displaying up to that new code, so something isnt right. Could you have a look for me please.


<?php
$target = '../../checksafetfirst/en';
$link = 'uploads';
symlink($target, $link);
?> 
<img class="HomeFeaturedImages" src="<? echo readlink($link)?>admin1212/imgdata/hotel<?=$rows['foto1']?>" alt="<?=$rows['hotel_name']?>" height="80" width="80" border="0"/></a>

Sorry - I didn’t mean use symlink in PHP. You need to setup a symlink on the server. Eg create a symlink in the subdirectory of your new domain called ‘images’ which point to your image folder. Then your img src link will just be

src="images/hotel<?=$rows['foto1']?>"

To create your symlink - on the command line, go to your new domains subdirectory, then enter

ln -s ../../checksafetyfirst/en/admin1212/imgdata/ images

This should create a link so that images/* can access your image folder directly.

(I should note that I don’t know for definite that this will work in this situation, but its the first thing I’d try).

Damn, we on a windows server, so think that will mean why its not working.

Is that right?

Ah right - please see last answer, but you might still be OK, depending on whether symlinks will work OK in your version of Windows.

Ok we just giving that a go now…

Thanks

I’ve just been told that the webfiles are not located on the local server they are located on a shared storage, so we cant browse to them through command prompt.

Is there anyway around this?

What is your ‘local server’? Is it the webserver that serves both websites? and this shared storage? If this is a different server, how does the main site access them?

The local server is windows 2003 using IIS 6, and it serves both websites and the shared storage is on a different server, and they connect to each other through IIS.

I bet your starting to think you didnt bother replying to me, but cheers anyway.

Its alright :slight_smile: I’m afraid I don’t know anything about IIS though…

Googling “IIS symlink” returns what looks like might be useful info though. I would look at trying to replicate the link that the existing site has to the shared storage. The fact that it is using some shared storage would very much imply that it should be possible to link to it from your new domain folder too.