开发者

zend site needs alias too

I have a zend site where DocRoot is set to public/ and URL as (http://dothat.com/con开发者_开发问答trollerA/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.


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.


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]


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..

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜