this is what i use for my subdomains:

if(!isset($_GET['url'])){
        $_GET['url'] = '/';
}

if (env("HTTP_HOST") == "admin.mydomain.com") {
    $_GET["url"] = "admin/" . $_GET["url"];
}elseif(env("HTTP_HOST") == "admin.mydomain"){
                if(!isset($_GET['url'])){
                        $_GET['url'] = "/";
                }
                $_GET["url"] = "admin/" . $_GET["url"];
}elseif (strpos($_GET["url"], "admin") === 0) {
    header ("HTTP/1.0 404 Not Found");
    die();
}


Put that in bootstrap.php


2. Then explode your $_GET[url] to find the subdomain.

That should be all you need

just make sure to set up a wildcard DNS entry for your domain

On May 1, 7:00 am, "Marcin Domanski" <[EMAIL PROTECTED]> wrote:
> please search, there is a bakery article with great comments and a lot
> f resources in this group.
>
> On Thu, May 1, 2008 at 12:50 PM, Kupe3 <[EMAIL PROTECTED]> wrote:
>
> >  Hi
> >  i have companies controler, so i have
> >  site.com/companies/details/company_name
> >  but now they want to have subdomains for each company, so it should
> >  accept links like
> >  http://company_name.site.comand redirects 
> > tohttp://site.com/companies/details/company_name
> >  As i am not expirienced in regex and writing router rules, i would ask
> >  for some help
>
> >  thanks in advance
>
> --
> Marcin Domanskihttp://kabturek.info
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to