kobhqlt
kobhqlt

Reputation: 78

Zend and Multidomain app

I need to create multi domain for my Zend project but I dont know how.

What I want to do is :

The user types "www.mydomain42.tld" and he's on "www.myzendapp.tld/domain/42" without seeing it.

How can I do this ?

Thank you.

Upvotes: 0

Views: 209

Answers (1)

Paul Bain
Paul Bain

Reputation: 4397

You may want to look at adding a method into your Bootstrap.php class to check the domain at initiation and to set these variables in some globally accessible register.

This means you won't need to mess with your routes for every part of the application.

e.g.

<?php

class Bootstrap extends Zend_Application_Bootstrap_Bootstrap{
    protected function _initDomain(){
        //Check Url
        switch($_SERVER['HTTP_HOST']){
            case 'www.example.com':
                $id=42;
                break;
        }
        $org = // get org from db?!
        Zend_Registry::set('org',$org);
    }
}

Upvotes: 2

Related Questions