View Full Version : Question about code/pages in an addon domain
lazywolfy
06-12-2008, 11:09 AM
Hi everyone, i'm new to bh so please go easy :p
After creating an addon domain/directory and adding some files/folders/images to it (which I moved from my old site/host) I noticed that all the images in index.html weren't showing up.
I figured it out fairly quickly that since the index.html file previously resided in a main domain directory, the code in the index.html file was referencing the old path "/images/image.gif" instead of the new path "/addon/images/image.gif" so I opened the html editor to edit the code and was asked "Please select the url where this file will be served from:"from which I chose my addon domain which then made the addon directory the "main" domain for all the content within it and allowed me to leave the code as is "/images/image.gif". Which is exactly what I wanted.
That was simple because it was one single index.html file but now I need to transfer over another site which is a ipb forum and it's pretty big. It also currently resides in a main domain directory but will be moved to an addon domain directory here on bh. When I move the forum to the addon directory, I'll need to go into the forum admincp and change all the setting to reflect the new directory structure but is there a way to make the addon domain the main domain so it's as if the forum never moved? or should any file placed within an addon domain automatically read that folder as the main folder?
I hope this makes sense, and i'm not actually trying to change the .htaccess file or anything like that, because I still have an existing site on my main domain, so I'll need to keep that intact.
Please let me know if this is possible. (if you can understand my question lol)
Eriksrocks
06-12-2008, 11:29 AM
Assuming that the forum is accessible from www.addondomain.com then you should be fine. Nothing should need to be changed.
So basically...
or should any file placed within an addon domain automatically read that folder as the main folder?
Yes. :)
lazywolfy
06-12-2008, 11:34 AM
Assuming that the forum is accessible from www.addondomain.com then you should be fine. Nothing should need to be changed.
So basically...
Yes. :)Well that's what I thought too but as I mentioned earlier the images in the index.html file didn't work until I changed the settings in the html editor. Any idea as to why it didnt work then? I know there has to be a simple solution for this but most of my brain cells are already dead! :cool:
Bob Barr
06-12-2008, 11:51 AM
Well that's what I thought too but as I mentioned earlier the images in the index.html file didn't work until I changed the settings in the html editor. Any idea as to why it didnt work then? I know there has to be a simple solution for this but most of my brain cells are already dead! :cool:
<speculation>
I think the problem with the images on the earlier domain move was the initial '/' in the file names. It should not have been necessary to change all of the links to '/addon/images...'. I have several addon domains, each has its own 'images' folders. None of them require me to specify the addon domain's name in the links. (If I'm not mistaken, that initial '/' is telling the server to start from your account's 'public_html' folder.)
Eliminating the slash in front of 'images' would indicate that the images folder is one level down from the current folder, whatever that current folder is.
</speculation>
Early Out
06-12-2008, 12:12 PM
Eliminating the slash in front of 'images' would indicate that the images folder is one level down from the current folder, whatever that current folder is.Absolutely correct. Whenever possible, use relative addresses. This allows the pages to work no matter where you plant them - in your main domain, in a subdomain or addon domain subdirectory, etc. And relative addresses should never start with a slash - that defeats them.
lazywolfy
06-12-2008, 12:27 PM
<speculation>
I think the problem with the images on the earlier domain move was the initial '/' in the file names. It should not have been necessary to change all of the links to '/addon/images...'. I have several addon domains, each has its own 'images' folders. None of them require me to specify the addon domain's name in the links. (If I'm not mistaken, that initial '/' is telling the server to start from your account's 'public_html' folder.)
Eliminating the slash in front of 'images' would indicate that the images folder is one level down from the current folder, whatever that current folder is.
</speculation>You're exactly right bob...i was incorrectly putting a / in front. At the time I created that file, i had a feeling I was either doing something wrong or leaving something out ...and even when trying to figure this piece out, something kept telling me that it probably had something to do with my original code rather than the actual cpanel settings. lol see what I mean about dead brain cells. :p
So once I move my forum over to the new addon (and add the db's and whatever else), it should read the addon as the main folder since it's all in php and I haven't cursed the code with my deadly touch right? Thanks for your help guys.
btw bob...wear like colors today...it'll be a hot one in mh. :cool:
PS i have another question about uploading but i'll start a new thread for that one. thanks
Eriksrocks
06-12-2008, 12:31 PM
(If I'm not mistaken, that initial '/' is telling the server to start from your account's 'public_html' folder.)
Actually, I believe it's telling the server to start from the web root of that domain, so with an addon domain it wouldn't be the public_html folder, it would be the addon folder. So paths like "/images/bg.gif" should still work correctly on an addon domain assuming the images are uploaded. :)
Bob Barr
06-12-2008, 12:45 PM
Actually, I believe it's telling the server to start from the web root of that domain, so with an addon domain it wouldn't be the public_html folder, it would be the addon folder. So paths like "/images/bg.gif" should still work correctly on an addon domain assuming the images are uploaded. :)
I'm not entirely sure on that, Erik. If that were the case, I'd think that it wouldn't have been necessary to include the 'addon/' portion in the link.
Early Out
06-12-2008, 12:53 PM
<speculation>What Erik is saying may be true in some environments, but I'm guessing that because of the way BH implements addon domains and subdomains, as simple subdirectories under the main domain, the more general rule may not apply.</speculation>
I'll have to try a little experiment to find out - I'll be back....
Early Out
06-12-2008, 12:59 PM
Interesting result - Erik is correct, at least as far as a properly configured subdomain is concerned. The leading slash goes to the root of that subdomain, not all the way up to public_html.
lazywolfy
06-12-2008, 01:20 PM
I just tried it with and without a slash (/) and it worked fine both ways without having to specify the addon name...why it didn't work for me originally I don't know, but i hope it doesn't mean that it will give me trouble when i move the forum....(crosses fingers)
Early Out
06-12-2008, 01:28 PM
I'm guessing you're home-free, and that it will all work fine when you move your stuff. It should, based on what I've seen, and despite what I said earlier. Why it failed earlier is a bit of a mystery, but perhaps you just beat BH to the punch, accessing your addon domain before the nameservers were configured properly.
It's still good advice to stick to purely relative links, of course, since that lets you move stuff into deeply-nested subdirectories without having to mess with the links.
vBulletin® v3.7.2, Copyright ©2000-2008, Jelsoft Enterprises Ltd.