Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 07-11-2007, 07:15 PM   PM User | #1
dizyn
Regular Coder

 
Join Date: May 2006
Posts: 107
Thanks: 1
Thanked 0 Times in 0 Posts
dizyn has a little shameless behaviour in the past
creating subdomains

Today I was browsing ebay.com and I come to know that for every main category they created a sub domain, like there is a category watches and the URL for watches will be like watches.ebay.com etc.
Now I wanted to know what whey is to so that I can create a sub domain using PHP script.


basically the thing i want to copy ebay model and that's why i am looking for making these sub domains.

if any one has any good suggestion also suggest me on it and you know they [ebay] people has a huge database can mysql bear this thing or not?
dizyn is offline   Reply With Quote
Old 07-11-2007, 07:25 PM   PM User | #2
kosstr12
Regular Coder

 
kosstr12's Avatar
 
Join Date: Apr 2007
Location: Woodstock, Georgia
Posts: 428
Thanks: 7
Thanked 5 Times in 5 Posts
kosstr12 is on a distinguished road
I dont know too much about php, but im pretty sure you cant create sub-domains. Usually you make sub-domains through your host, and most of the time you can only create them on paid hosts.

HTH,
kosstr12
kosstr12 is offline   Reply With Quote
Old 07-11-2007, 07:30 PM   PM User | #3
Nightfire
Senior Coder

 
Nightfire's Avatar
 
Join Date: Jun 2002
Posts: 4,266
Thanks: 6
Thanked 48 Times in 48 Posts
Nightfire is on a distinguished road
You can create them via php, but it's much easier to use mod-rewrite to create 'fake' subdomains. I'm sure that's what ebay does, can't imagine them having hundreds of subdomains all of which contains the same things
__________________
Blue Panda
Website Design | 1 Pound Ads | 'ow much? | Coding Geeks
Nightfire is offline   Reply With Quote
Old 07-12-2007, 05:32 AM   PM User | #4
likon
Regular Coder

 
Join Date: Apr 2007
Posts: 141
Thanks: 3
Thanked 1 Time in 1 Post
likon is an unknown quantity at this point
how to create " fake " domain then? lol
likon is offline   Reply With Quote
Old 07-12-2007, 07:23 AM   PM User | #5
Fumigator
UE Antagonizer


 
Fumigator's Avatar
 
Join Date: Dec 2005
Location: Utah, USA, Northwestern hemisphere, Earth, Solar System, Milky Way Galaxy, Alpha Quadrant
Posts: 7,686
Thanks: 42
Thanked 637 Times in 625 Posts
Fumigator is a glorious beacon of lightFumigator is a glorious beacon of lightFumigator is a glorious beacon of lightFumigator is a glorious beacon of lightFumigator is a glorious beacon of light
lol, Google ftw

http://www.modrewrite.com/
__________________
Fumigator is offline   Reply With Quote
Old 07-13-2007, 05:43 PM   PM User | #6
eak
Regular Coder

 
eak's Avatar
 
Join Date: Jun 2002
Location: Nashville, TN
Posts: 354
Thanks: 0
Thanked 26 Times in 26 Posts
eak is on a distinguished road
I have had to create dynamic subdomains based on values in a mysql db for some projects at work and its not as hard as you would think.

What I have is wildcard DNS, apache virtual hosts, and php working together to pull it off.

Widlcard DNS will send all request to my server where I have normally have 3 virtual host for every site.
one is mydomain.tld
another is admin.mydomain.tld
the last is *.mydomain.tld

it needs to go in this order so that real subdomains don't get served by *.mydomain.tld

Once there, I use modrewrite (only on *.mydomain.tld) to set an ENVIRONMENT variable, which is available to php, for the subdomain.

I can then show dynamic content for the subdomain.
It can act as username, company name, project, or some other unique identifier, which is stored in MySQL.
__________________
eak | "Doing a good deed is like wetting your pants; every one can see the results, but only you can feel the warmth."
eak is offline   Reply With Quote
Old 07-16-2007, 03:25 AM   PM User | #7
jayemvee
New Coder

 
Join Date: Jan 2007
Posts: 64
Thanks: 0
Thanked 1 Time in 1 Post
jayemvee is an unknown quantity at this point
From Google

Dynamic subdomains... like on imeem and such...

PHP Code:
$site_url strtolower($_SERVER['HTTP_HOST']);
if(
strpos($site_url,':')) $site_url substr($site_url,0,strpos($site_url,':'));

if (
$site_url == 'example.org'header('Location: http://www.example.org');
elseif (
$site_url!= 'www.example.org')
{
if(
strpos($site_url,'example.org')) $host_length strlen('example.org');

$user substr($site_url,0,strlen($site_url)-$host_length-1);

header("Location: http://www.example.org/userpage_redirect.php?user=$user");

__________________
No trees were harmed in the transmission of this message.
However, a rather large number of electrons were temporarily
inconvenienced.
jayemvee is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 03:33 PM.


Advertisement
Log in to turn off these ads.