Forum Moderators: martinibuster
My host allows subdomains that are actually mapped to a folder in the main domain.
So htttp://fresh.greenmoney.com gets resolved but it is actually htttp://www.greenmoney.com/fresh/.
Questions:
Don't understand what you mean LM.
I got to looking at it and it appears that mirroring each subdomain with the common elements and using document relative paths would be the safest way to go. The absolute paths would make updating more centralized though.
I also sent her a link to this discussion so she can add anything else that might help.
I have found that I've had no problems though with just using absolute links.
The reason I ask is because it would be so much easier to maintain a large site from the central directory as far as look and feel...i.e. style sheets, logo's.
I’m hoping my friend Jennifer will jump in when she reads this and see if she has another point of view. There are not enough people either using canonicals yet for optimization/navigation and those that are, aren’t yet talking about it.
From a design standpoint, absolute linking of graphic files is a pain.
Toolman, I'm just really starting to use third level domains in my designs to theme out the sites. Dealing with images was the hardest part for me to get an organized process going. I use Dreamweaver and keep templates for each of my subdomains.
I don't want duplicate graphics locally (what a nightmare) and I want as minimum of duplicates on the server as possible without absolute linking.
This is how I create my local directory structure.
<Site Name>
...<images>
......<main> - this is my master images directory. I keep all the images that are common to all subdomains and used throughout all my templates
...<subdomain1>
......<images> - this is where images that are only used in subdomain1 are stored
...<subdomain2>
......<images> - this is where images that are only used in subdomain2 are stored
The server looks like
<public_html>
...<images>
......<main>
...<subdomain1>
......<images>
.........<main> - main copy
...<subdomain2>
......<images>
.........<main> - main copy
etc.
Locally I keep everything under a centralized directory (have to or I'd go insane). Then if I make a change to images that effect the template design, I upload the <main> directory to each subdomain's images directory.
If I make a change to images that are exclusive to a subdomain, I just go to the local subdomain/images directory and upload the new graphics.
The key for me is to keep images that are common to all subdomains separated in one place so that I can just upload the entire the directory when changes to the main template occur.
I do not use absolute linking for graphic files. There's too many times when I need to make a graphic change such as renaming or moving. I want the change to the graphic to be automated. Also, I don't want to go through the process of hardcoding every image placement...it's too much of a pain.
I do understand that this means several copies of my main (common) images on the server. If space limitations are a major consideration for you, than absolute graphic linking is probably the best answer.
For me, it's much easier to have multiple copies of the main images on the server so that I can continue to use relative graphic linking.
However, I do use absolute linking for every link within each subdomain (even though some can be called relatively). As littleman suggested, it keeps all content within each subdomain "walled off".
Also I have one style sheet file that I keep in the my local <Site Name> directory. I upload this file to each subdomain directory too. This is the other "duplicate" that I put on the server.
If anyone has any other suggestions, I'm open to finding an easier way.
Jennifer
Nice to have you 'on board'! Thanks for adding your knowledge to this discussion. I think we're all learning how this works.
Debra
This would be the right way to set it up in the httpd.conf file:
NameVirtualHost 111.222.111.222
<VirtualHost 111.222.111.222>
DocumentRoot /path/to/domain.com/
ServerName www.domain.com
CustomLog /path/to/domain.com.log
</VirtualHost>
<VirtualHost 111.222.111.222>
DocumentRoot /path/to/sub1.domain.com/
ServerName sub1.domain.com
CustomLog /path/to/sub1.domain.com.log
</VirtualHost>
VirtualHost 111.222.111.222>
DocumentRoot /path/to/sub2.domain.com/
ServerName sub2.domain.com
CustomLog /path/to/sub2.domain.com.log
</VirtualHost>
And Tool's hosting company is probably doing something like this:
NameVirtualHost 111.222.111.222
<VirtualHost 111.222.111.222>
DocumentRoot /path/to/domain.com/
ServerName domain.com
CustomLog /path/to/sub1.domain.com.log
</VirtualHost>
<VirtualHost 111.222.111.222>
DocumentRoot /path/to/domain.com/sub1/
ServerName sub1.domain.com
CustomLog /path/to/domain.com.log
</VirtualHost>
<VirtualHost 111.222.111.222>
DocumentRoot /path/to/domain.com/sub2/
ServerName sub2.domain.com
CustomLog /path/to/domain.com.log
</VirtualHost>
And so on.
With such a layout the sub-domains share file structure, which unnecessarily creates the risk of duplicates. That is why I am recommending absolute links *in this case* to minimize the risk.
I've always setup sub-domains up using redirection to the subdirectory instead of the subdomain root. I will change this configuration and see what happens.
However, even if you did it this way, that still doesn't change the fact that you have to have individual image directories setup for each sub-domain. How do you keep it all separated locally without creating a completely separate parent directory for each subdomain...
Hope I'm making my question clear. It's more of a design organization question than anything.
Also, even using the redirection to the folder subdomain setup, what difference does it make if graphic files are called relatively? I don't understand your statement here:
"With such a layout the sub-domains share file structure, which unnecessarily creates the risk of duplicates. That is why I am recommending absolute links *in this case* to minimize the risk."
Are you referring to graphic linking or hyperlinking? Again, what difference does it make to a spider if graphics are shared? Maybe this is just my ignorance on what a spider sees.
I've always setup sub-domains up using redirection to the subdirectory instead of the subdomain root.
NameVirtualHost 111.222.111.222
<VirtualHost 111.222.111.222>
ServerName sub1.domain.com
ServerAdmin wwwadmin@domain.com
DocumentRoot /home/user/public_html/sub1
CustomLog domlogs/sub1.domain.com combined
ScriptAlias /cgi-bin/ /home/psbv/public_html/sub1/cgi-bin/
</VirtualHost>
The problem I'm seeing is that my setup is controlled by the user account. I don't know what the /path/to/sub1.domain.com/ is except /home/user/public_html/sub1
ScriptAlias /cgi-bin/ /home/user/public_html/sub1/cgi-bin/
instead.
Tool, in your case I would be less concerned with the images, but with textual content. If you want to use relative paths for images then you should be okay. It is the hyperlinks where the danger lies.
DocumentRoot /home/user/public_html
ServerName www.domain.com
DocumentRoot /home/user/public_html/sub1
ServerName sub1.domain.com
DocumentRoot /home/user/public_html/sub2
ServerName sub2.domain.com
Isn't this what you said?
DocumentRoot /path/to/domain.com/
ServerName domain.comDocumentRoot /path/to/domain.com/sub1/
ServerName sub1.domain.comDocumentRoot /path/to/domain.com/sub2/
ServerName sub2.domain.com
I don't see the difference. To me that's the same setup?? So how come my are isolated. Maybe I'm not understanding you...
When I upload files for third level domains, I am uploading into one of the subdirectories of the main acount. I don't have separate accounts for each sub-domain setup.
DocumentRoot /home/user/public_html/base -> or whatever you want to call the folder for the root domain.
ServerName www.domain.com
DocumentRoot /home/user/public_html/sub1
ServerName sub1.domain.com
DocumentRoot /home/user/public_html/sub2
ServerName sub2.domain.com
It is a simple enough change to adopt.
For simplicity I usually do something like this:
DocumentRoot /home/user/public_html/domain.com
ServerName www.domain.com
DocumentRoot /home/user/public_html/sub1.domain.com
ServerName sub1.domain.com
DocumentRoot /home/user/public_html/sub2.domain.com
ServerName sub2.domain.com
The main index.html sits under public_html so instead I'd just map the main domain to a subdirectory too. Then everything is completely independent...and not a subdirectory of another.
Hey... thanks for working this out with me. Learn something every day. :)
Appreciate your time!
(I had posted my question in a different thread but Marcia pointed me here and I'll continue here)
Our situation is a little different:
We have 2 domains
www.domain1.com
www.domain2.com
They have different IP addresses
On the server:
/public_html
/subdirectory1 (where www.domain1.com resides)
/subdirectory2 (where www.domain2.com resides)
The 2 domains have many pages and images in common
/public_html
/subdirectory1
page1.htm
page2.htm
image1.jpg
etc
/subdirectory2
page1.htm (same as above)
page2.htm (same as above)
etc
To simplify maintenance we would like to have only 1 physical copy of each common page and image
/public_html
/subdirectory1
page1.htm (real)
page2.htm (real)
etc.
/subdirectory2
page1.htm (created with ln -s public_html/subdirectory1/page1.htm public_html/subdirectory2/page1.htm)
...etc...
All hyperlinks on our pages are relative
Any problems?
Mack, generally the URL redirects that are commercially promoted are bad for promotion -- but it depends on how it is done. Maybe we should make a new thread?
Always_here, you are running mirrors? It really is not a good idea to have the same content spiderable on multiple domains, but either of your methods will put you at equal risk.