title: How to route multi subdomain with zend router hostname
body: <p>I need to create routing in Zend to simply copy the current live site url structure which is sadly inconsistent</p>
  
  <p>What i want to do is to route subdomain as follow:</p>
  
  <p>www.site.com -> static router</p>
  
  <p>a.site.com &amp; b.site.com -> category controller</p>
  
  <p>c.site.com &amp; d.site.com -> location controller</p>
  
  <p>the rest sub domain -> user controller</p>
  
  <p>could anyone guide me how to solve this, thanks.</p>
  
  <p>UPDATE:</p>
  
  <p>First thanks Fge, vote your answer, it works but i need some more advice:</p>
  
  <ol>
  <li><p>Since i have many subdomains for each rules is there a better way than add the rules in looping</p>
  
  <p>foreach($subdomains as $a){
   $tr = new Zend_Controller_Router_Route_Hostname(
      "$a.site.com",
      array(
         'module'  => 'mod',
         'controller' => 'ctrl',
         'param_1' => $a
      ));
   $router->addRoute($a,$tr); 
  }</p></li>
  <li><p>How to combine it with other routing type to parse the parameters (chained?), something like <a href="http://a.site.com/:b/:c" rel="nofollow">http://a.site.com/:b/:c</a>, i want t parse it to param_1 (a), param_2 (b), param_2 (c)</p></li>
  </ol>