How to setup categories on sub-domains??

Discussion corner for Developers of Serendipity.
Post Reply
mdnava
Regular
Posts: 57
Joined: Wed Dec 15, 2004 10:17 pm

How to setup categories on sub-domains??

Post by mdnava »

Hello, this is for a new project I'm about to start...

Anybody knows if there is an easy way to setup a Blog category in a sub-domain?... I mean with only the contents of one category and all its sub-categories.

I intend to setup about eight sub-domains, each one of them would have the content of only one category (and sub-categories) from the main Weblog, and the top domain would have the content of all categories of course... Something like slashdot does with sub-domains.

I'm currently thinking in setting up standalone shared installations on each sub-domain, all with the same database, and find a way for each sub-domain to fetch only posts from the specifed category.
Melvin D. Nava
Venelogía
Col. Kurtz
Regular
Posts: 450
Joined: Thu May 26, 2005 10:43 am
Location: Bonn, Germany
Contact:

Post by Col. Kurtz »

just an idea:

a) please read this

b) you could redirect each subdomain to the category (of the main domain) you want to be shown. you would only need to redirect all subdomains and not having to install s9y more than once.

c) if you remove all links to the root (in the header) nobody will be able to get out of the category (if you dont enter the url by hand)
Marc
mdnava
Regular
Posts: 57
Joined: Wed Dec 15, 2004 10:17 pm

Thanks but is not what I'm looking for...

Post by mdnava »

Thanks Marc,

I knew about that feature but is not what I'm looking for, this project will have a huge amount of articles in different topics.

For that much content, having really separate categories in sub-domains will improve SEO a lot and each topic will have its own place in search results.

Any other thoughts?
Melvin D. Nava
Venelogía
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Thanks but is not what I'm looking for...

Post by garvinhicking »

Your request is a bit unconventional, and it seems to me like being abused for spam. But I'll still give a rough draft of what you could do:

1. Setup a "subdomain.php" file for your subdomains, make that the IndexFile. All subdomains need to point to the single document root of your single s9y installation. Subdomain.php should just contain:

Code: Select all

<?php
$catid = 0;
switch($_SERVER['HTTP_HOST']) {
 case 'category1.host.com': $catid = 1; break;
 case 'category2.host.com': $catid = 2; break;
 case 'category3.host.com': $catid = 3; break;
}

header('Location: http://' . $_SERVER['HTTP_HOST'] . '/index.php?serendipity[category]=' . $catid);
?>
Where "X" is the ID of the category that subdomain should solve.

2. Turn on "HTTP host autodetection".

Now, the "feature" is that basically all subdomains just point to the central s9y installation. But based on the HTTP_HOST, the right category is always selected.

If you want to never allow to see other categories from within a subdomain, you can make a plugin that hooks to the frontend_configure event and sets $serendpity['GET']['category'] based on the HTTP-HOST. You'll have to figure that out for yourself though, or convince me that what you want to do is not solely for Spamming/SEO. :-))

Best regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Thanks but is not what I'm looking for...

Post by garvinhicking »

(I moved your response here, mdnava)
mdnava wrote:Well Garvin, I don't think that is what I'm looking for.

My reasons are mainly for SEO but definitely not for Spamming and It looks pretty good to my to separate different topics in different sub-domains.

I can also expect to have heavy bandwitch and processor usage as my own Blog does, which is currently DOWN waiting while I setup a dedicated... And by having separate sub-domains if this gets out of hands I can easily spread traffic among other servers.
Why is it not what you're looking for? It really seems fit, what are your problems with the solution?

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
mdnava
Regular
Posts: 57
Joined: Wed Dec 15, 2004 10:17 pm

Sorry about that

Post by mdnava »

Sorry about that, I think my finger slipped :P... I was trying to delete the post but I found out it had already been done.

About the topic... I don't think that's what I'm looking for because I don't want redirects, I'm talking about setting up a full standalone Blog from just one category and its sub-categories.

So far I've planning on setting up shared installations with the same database and at some point in the script of each sub-domain (or the main one) limit posts to the specified category.

Now that you are here I'll take the opportunity to ask an easy question:

Would it work If I just set the $catid on index.php of deployment for a specific category? (even before main index.php gets included)
Melvin D. Nava
Venelogía
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Sorry about that

Post by garvinhicking »

About redirects - you could get around those by using a plugin only, listening on the frontend_configure as I mentioned. Then you don't need a redirect, because the category is set depending on the httphost.

Try this plugin: http://nopaste.php-q.net/162614

Look at the lines where it says switch($_SERVER['HTTP_HOST']). Insert your domain names there, and let all subdomains point to the same document root.

Your idea with shared installation and same database will not work, as you cannot configure your weblogs independently if they use the same database.
Would it work If I just set the $catid on index.php of deployment for a specific category? (even before main index.php gets included)
That would work, but a plugin is much nicer. :-)

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
mdnava
Regular
Posts: 57
Joined: Wed Dec 15, 2004 10:17 pm

Re: I'll give it a try!!!

Post by mdnava »

Woahh! that has to be the fastest plug-in ever... I'll try it!
garvinhicking wrote:Your idea with shared installation and same database will not work, as you cannot configure your weblogs independently if they use the same database.
I had no intention in configuring weblogs (but sounds good tho), I intent to have same settings for all sub-domains... Of course I know problems could arise but those exist to be solve.

I'll try your plug-in first, I think I was wrong and it might work pretty well.

Man, and I owe you a gift or something for this and other issues you helped me with, too bad in Venezuela we have restricted currency exchange so I cannot use credit cards outside without authorization... But I'm pending on this.

Have a nice day!
Melvin D. Nava
Venelogía
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: I'll give it a try!!!

Post by garvinhicking »

You're welcome. I hope it works out for you! :)

Interesting to hear about the Venezuala-credit thing - didn't know about this. Is paypal then problematic/restricted there as well?

Best regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
mdnava
Regular
Posts: 57
Joined: Wed Dec 15, 2004 10:17 pm

Re: I'll give it a try!!!

Post by mdnava »

garvinhicking wrote:Interesting to hear about the Venezuala-credit thing - didn't know about this. Is paypal then problematic/restricted there as well?
Yeps!!, in Venezuela since 2003 everything about currency exchange (including Paypal) is restricted, we cannot even buy one US dollar without government's permission, and that's pretty hard to get...

If Paypal allows to wire some money into to that account I guess is not much of a problem (for me), but if cash or credit card is required then is totally out of the question.
Melvin D. Nava
Venelogía
Post Reply