Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Subdomains and Custom Templates

Quote Reply
Subdomains and Custom Templates
My apologies if this has been asked before...

Can someone point me to a howto that explains how to access one Links database from multiple subdomains (e.g. subdomain.domain.com) and use custom templates created uniquely relevant to each subdomain?

Alan Frayer
Don't just read the news - make the news!
Your World News - http://yourworldnews.frayernet.com
Quote Reply
Re: [afrayer] Subdomains and Custom Templates In reply to
Lacking a formal HOW-TO Unsure I guess I need to ask more specific questions...

Lets say I have a second site I wish to add as a subdomain, but want this subdomain to use the main database, utilizing a separate set of templates relevant to the subdomain. The sales information suggested this might be possible, but my (admittedly weak) understanding of subdomains tells me they have their own CGI directory. This being the case, how can I ...

a) tell the subdomain to use the CGI housed in the main domain, and

b) tell the Links software to use a different set of templates from those used by the main domain?

Alan Frayer
Don't just read the news - make the news!
Your World News - http://yourworldnews.frayernet.com
Quote Reply
Re: [afrayer] Subdomains and Custom Templates In reply to
Hi,

If you have your own server then to add subdomains you need to edit the httpd.conf file and add more VirtualHosts. It shouldn't be too complicated. You can then point the subdomains at the same directory as the main domain to use the same files. You can then pass a variable in the url to tell the program which template set to use and use rewrite rules to hide this variable.

Hope that points you in the right direction.
Laura.
The UK High Street
Quote Reply
Re: [afinlr] Subdomains and Custom Templates In reply to
In Reply To:
If you have your own server then to add subdomains you need to edit the httpd.conf file and add more VirtualHosts. It shouldn't be too complicated. You can then point the subdomains at the same directory as the main domain to use the same files. You can then pass a variable in the url to tell the program which template set to use and use rewrite rules to hide this variable.

This could work if the site only consisted of Links, but Links will be part of an HTML structure that has to also be flexible. For this reason, I was looking at a traditional subdomain, rather than just buying secondary URLs.

Now, if I were to switch to a subdirectory/secondary URL method, then the URL variable would probably work nicely. If I can call the template set via a URL variable, what would that variable be? (I was never able to get a complete list of supported URL variables supported.) And can someone give me a link to where I can learn more about the rewrite rules?

Alan Frayer
Don't just read the news - make the news!
Your World News - http://yourworldnews.frayernet.com
Quote Reply
Re: [afrayer] Subdomains and Custom Templates In reply to
In Reply To:
This could work if the site only consisted of Links, but Links will be part of an HTML structure that has to also be flexible. For this reason, I was looking at a traditional subdomain, rather than just buying secondary URLs.[/quote]

Not sure I understand why you think this is a problem - you just create VirtualHosts for each subdomain. Or even just use the VirtualHost you have setup for the main directory and use rewrite conditions to redirect the subdomains. If you want the subdomains to have a different path on your server, then I think you could just rewrite the GLinks urls to the main GLinks path but I haven't thought this through fully.

The variable you need is t for a different template set as far as I can remember.

This is the apache document for using mod_rewrite:
http://httpd.apache.org/...mod/mod_rewrite.html
Quote Reply
Re: [afinlr] Subdomains and Custom Templates In reply to
Thank you. I didn't think VirtualHosts through, having not configured them before. And thank you for the variable and the link.

Alan Frayer
Don't just read the news - make the news!
Your World News - http://yourworldnews.frayernet.com