homepage Welcome to WebmasterWorld Guest from 54.196.162.238
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Subscribe to WebmasterWorld
Home / Forums Index / WebmasterWorld / Webmaster General
Forum Library, Charter, Moderators: phranque & physics

Webmaster General Forum

    
Refer to folder outside domain
rsndll




msg:3495962
 9:27 am on Nov 4, 2007 (gmt 0)

I have inherited some websites which all use the same webspace which is divided into folders.

The overall webspace is referred to by say www.abc.com and there is a folder inside this which is referred to by say www.123.com

abc.com has a folder called photos whose contents can obviously be easily referred to by pages in abc.com using /photos/mypic.jpg

My problem is that I want to refer to images in the photos folder from www.123.com.

I can do it using www.abc.com/photos/mypic.jpg but I'd rather use some form of relative addressing if possible, can this be done?

I am using php if that helps.

 

jtara




msg:3496176
 5:52 pm on Nov 4, 2007 (gmt 0)

Not enough information. What kind of hosting service (shared, dedicated, VPS, etc.) and what web server (Apache, IIS, etc.) are you using?

Assuming Apache, are you able to modify Apache configuration files, or are you restricted to using .htaccess?

How is one domain being redirected to the other? Using server redirects, via a third-party (registrar, etc.) redirect site (sometimes erroneously called "DNS redirect"), framed redirect, etc?

How you do this is going to depend on the details of your server configuration.

The best way to do this would be to set-up multiple virtual hosts. Disk directories that have content that is in common between sites can be mapped from multiple hosts, using the same or different URL paths.

rsndll




msg:3496192
 6:58 pm on Nov 4, 2007 (gmt 0)

I am using shared hosting on an Apache server.
I don't have access to the config files, but I can use .htaccess.
I am with 1and1, I'm not using any redirects or framing, their Name Servers point to folders within my webspace.

jtara




msg:3496210
 7:34 pm on Nov 4, 2007 (gmt 0)

I'm not using any redirects or framing, their Name Servers point to folders within my webspace.

So, if somebody goes to www.123.com, they are going to see the home page for www.abc.com? Does some PHP code customize the HTML text, so that it shows the appropriate site name? In any case, if you are doing this, the browser's URL bar is going to show the wrong site.

Or is www.123.com a completely separate site with it's own host/hosting plan?

If the former, it's ot a good way to do this at all - you are making do with a hosting plan that really isn't suited for this. It's an SEO nightmare.

If your goal is just to simplify addressing within your documents, you might want to look at the HTML <BASE> tag. This will allow you to reference documents from another part of your site, or even another site altogether, in a relative fashion.

It's rather limited, though, in that it sets a base for all references made from a page.

jdMorgan




msg:3496217
 7:40 pm on Nov 4, 2007 (gmt 0)

Just to be clear, the DNS servers point the domains to the server's IP address, as DNS servers always do.
It is the server configuration that defines these "add-on" domains as subfolders below your "main domain" filespace.

One way to do this is to use symbolic links in the add-on domains' filespace -- these links make it appear that there is a virtual 'copy' of the shared folders/files in each domain's filespace.

Another way to do it is to use "Aliases" for the shared folder names, but this requires more control over the server configuration than is allowed by most "control panels."

Jim

jtara




msg:3496220
 7:49 pm on Nov 4, 2007 (gmt 0)

Sorry, I'm unfamiliar with 1&1's hosting plans, but just took a look. I gather that they do support virtual hosts. So, it's not just a matter of the DNS server pointing to different subdirectories.

Yes, a symbolic link could do the job, if you have access to a shell login in order to create one.

Otherwise, you can use an .htaccess redirect.

rsndll




msg:3496526
 7:20 am on Nov 5, 2007 (gmt 0)

Thanks for your help.
Sorry if I wasn't clear, I'm quite new to all this.

I think I will end up using full urls for the images that are outside the domain.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / WebmasterWorld / Webmaster General
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved