Welcome Guest, Not a member yet? Register   Sign In
Usernames as subdomains and a root website
#10

[eluser]Udi[/eluser]
Code:
$config['base_url']    = "http://".$_SERVER['HTTP_HOST']."/";
it defines your base url as http://username.domain.com

YOU ALWAYS LINK TO username.domain.com,
so its always:
username.domain.com/post/
OR
username.domain.com/view/

you just need to identify the username in your app..

I do something like this:
Code:
// $subdomain going to store the username...
        list($subdomain, $rest) = explode('.', $_SERVER['SERVER_NAME'], 2);
        if($subdomain == 'www') {
            // need to make sure its not www.username.domain.com
            // so I test again...
            list($subdomain2, $rest2) = explode('.', $rest, 2);
            // if its "domain" it means someone entered www.domain.com
            // IF NOT, then its actually www.username.domain.com
            if($subdomain2!="domain")
                $subdomain = $subdomain2;
        }
        // idenify your $subdomain in your database to get the user

you got the idea?


Messages In This Thread
Usernames as subdomains and a root website - by El Forum - 07-24-2010, 02:53 PM
Usernames as subdomains and a root website - by El Forum - 07-24-2010, 07:27 PM
Usernames as subdomains and a root website - by El Forum - 07-28-2010, 05:29 AM
Usernames as subdomains and a root website - by El Forum - 07-28-2010, 05:43 AM
Usernames as subdomains and a root website - by El Forum - 07-28-2010, 08:14 AM
Usernames as subdomains and a root website - by El Forum - 07-28-2010, 09:03 AM
Usernames as subdomains and a root website - by El Forum - 07-28-2010, 09:19 AM
Usernames as subdomains and a root website - by El Forum - 07-28-2010, 09:55 AM
Usernames as subdomains and a root website - by El Forum - 07-28-2010, 12:16 PM
Usernames as subdomains and a root website - by El Forum - 07-28-2010, 12:29 PM
Usernames as subdomains and a root website - by El Forum - 07-29-2010, 03:23 AM
Usernames as subdomains and a root website - by El Forum - 08-11-2010, 05:54 AM



Theme © iAndrew 2016 - Forum software by © MyBB