I'm using this in the bootstrap file to route <subdomain>.example.com
to http://www.example.com/controller/view/<subdomain>
By way of this code in the bootstrap file as suggested by many users.
$subdomain = substr( env("HTTP_HOST"), 0, strpos(env("HTTP_HOST"),
".") );
if( strlen($subdomain)>0 && $subdomain != "www" ) {
$_GET["url"] = "schools/view/" . $subdomain . "/" .
(isset($_GET["url"]) ? $_GET["url"] : "");
}
This is working fine. However when using the sub domain I can no
longer access other controllers (think: http://<subdomain>.example.com/reports).
The http://www.example.com/controller/view/<subdomain> is displayed
instead.
Whats the best method for using sub domains?
Creating everything via elements and requestActions and a loading
everyting with ajax seems inefficient and a pita
I really wouldn't even mind if it simply redirected to the full URL.
It seems hacky but it would work for a little while.
I think ultimately I would want to use the sub domain to adjust the
condition (my sub domain is equal to a generated slug field) in the
model to limit all querys by setting a condition to Controller.slug =
$subdomain. It seems like the correct MVC/cake way of doing it. But
this would require that I'd be able to access other controllers.
I'd rather not post anything specific publicly about the site I'm
working on but if seeing exactly what I'm saying would help you I'd be
glad to send you several links demonstrating the behaviors in private.
Check out the new CakePHP Questions site http://cakeqs.org and help others with
their CakePHP related questions.
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
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