thevikas
thevikas

Reputation: 1639

zend site needs alias too

I have a zend site where DocRoot is set to public/ and URL as (http://dothat.com/controllerA/action9/) - which is working properly.

I also need to run a copy of that site on the same server as (http://dothat.com/now/controllerA/action9/) running on same folder.

(The urls given are examples)

Please suggest on how can this be done without spoiling zend setup itself.

Upvotes: 3

Views: 1179

Answers (3)

calraiden
calraiden

Reputation: 1828

it's working for me

/etc/httpd/conf.d/zendproject.conf

Alias /zendproject/ /var/www/vhosts/zendproject/public/

<Directory "/var/www/vhosts/zendproject/public/">
    Options Indexes FollowSymLinks MultiViews
    AllowOverride All
    Order allow,deny
    Allow from All
</Directory>

public/.htaccess

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ /zendproject/index.php [NC,L]

Upvotes: 2

KSolo
KSolo

Reputation: 477

I would personally just do a simple Zend route in your Bootstrap.

Example:

protected function _initRoutes()
{   
    $this->bootstrap('frontController');

    $frontController = Zend_Controller_Front::getInstance();

    $nowRoute = new Zend_Controller_Router_Route("now/:controller/:action");

    $frontController->getRouter()->addRoute("now", $nowRoute);
}

Routes in Zend are very powerful and fun to setup. I actually have mine in an outside .ini file to make it easier to setup, even environment aware.

Upvotes: 2

gabel
gabel

Reputation: 512

How about that idea:

An alias in Apache (if it's the http server you're using)

Alias /now /path/to/zend/public   
<Directory /path/to/zend/public>      
  SetEnv APPLICATION_ENV development
  ...
</Directory>

And you have to care for the .htacces too

...
RewriteRule ^.*$ /now/index.php [NC,L] 

E.g. with another environmental variable for the path in the rewrite rule..

Upvotes: 0

Related Questions