Yes it is possible.
Basically in your DNS you should allow * .site.com to be hosted on the same machine. Thus, no matter which subdomain you type, the machine will be the same.
example dns entry:
* A 10.0.0.1
Then in the virtual host declaration you should put
<VirtualHost *>
DocumentRoot /var/www/path_to_site
ServerName site.com
ServerAlias www.site.com *.site.com
</VirtualHost>
, , , i.e. something.site.com city.site.com .
php ( AppController) .
, .
( ):
, . , :
cite1.site.com
AppController - :
class AppController extends Controller {
function beforeFilter(){
$host = explode('.', $_SERVER["HTTP_HOST"]);
$subdomain = $host[0];
Configure::write('city', $subdomain);
$this->City->getId($subdomain);
...
}
}
, , , .