i want to have several subdomains for my CakePHP application, like
http://app1.mydomain.com, http://app2.mydomain.com, http://app3.mydomain.com, ht开发者_StackOverflow中文版tp://app4.mydomain.com, etc.
how can i use app1, app2, app3, etc, as variables in my application (ie. every subdomain will have unique design)?
is it possible to "parse" url with .htaccess, or it's better to use php functions to achieve that?
tnx in adv!
You don't need any .htaccess rules for this. You can simply determine it in PHP with:
$subdomain = strtok($_SERVER["HTTP_HOST"], ".");
Take care that this is a user-supplied value. (Apache only whitelists the first level vhosts.)
Create Subdomains on the fly with .htaccess (PHP) Create subdomains on the fly with .htaccess (PHP)
精彩评论