/    Sign up×
Community /Pin to ProfileBookmark

creating dyanamic sub domain using php

Hi,

i just want to copy the blogspot.com feature in my open source blog cms
that every user have its own sub domain name on blogspot.com with his username or his desired name. eg {username.blogspot.com}

i dont want to create folder on server
i dont want to create actuall sub domain on server

i just want the behavior of the blogspot.com

any body please help me out
how to do this

i dont have enogh knowlegde about php, apache, .htaccess

thnx in advance

to post a comment
PHP

4 Comments(s)

Copy linkTweet thisAlerts:
@michael879Sep 19.2007 — I could be wrong but I dont think its possible. I think you need to actually setup a subdomain, or go into the dns server.
Copy linkTweet thisAlerts:
@haroon373authorSep 20.2007 — I could be wrong but I dont think its possible. I think you need to actually setup a subdomain, or go into the dns server.[/QUOTE]

You actally didn't read my post

i said as blogspot.com doing
Copy linkTweet thisAlerts:
@michael879Sep 21.2007 — I read your post, and what blogspot is doing seems to be what everyone else is doing. Maybe theyre doing some of it with php (like creating directories for the users) but Im sure theres more to it
Copy linkTweet thisAlerts:
@SheldonSep 21.2007 — It is easy, If your DNS is set up with a wildcard to point to your main site.

Here is a start, all you have to set is the domain var, and set this to your domain name with out the .com

[code=php]
<?php

$domain = "apple"; // eg: apple.com
$host = $_SERVER['HTTP_HOST'];
$vars = explode(".", $host);
if(($vars['0'] != "www") or ($vars['0'] != $domain)){
if(file_exists("/{$var['0']}/")){
header("Location: /{$var['0']}/");
}
}
echo("The Sub Domain is not a valid user, so here is the main site.");

?>[/code]
×

Success!

Help @haroon373 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...