/** * Parses a string url into an array. Parsed urls will result in an automatic * redirection * * @param string $url The url to parse * @return boolean False on failure */ public function parse($url) { $params = parent::parse($url); if ($params === false) { return false; } $Domains = new Domains(); $subdomain = $Domains->getSubdomain(); $masterDomain = Configure::read('Domain.Master'); $defaultRoute = Configure::read('Domain.DefaultRoute'); $Tenant = new Tenant(); if (!$Tenant->domainExists($subdomain) && $params != $defaultRoute) { if (!$this->response) { $this->response = new CakeResponse(); } debug($this->response); die; $status = 307; $redirect = $defaultRoute; $this->response->header(array('Location' => Router::url($redirect, true))); $this->response->statusCode($status); $this->response->send(); $this->_stop(); } return $subdomain; }