开发者

How can I set Zend Framework to run on sub directory?

I want to set the Zend Framework to run on a sub directory. I开发者_高级运维s it possible?


Maybe you're looking for Virtual host with apache ? But I'm not sure about what you're talking

http://framework.zend.com/manual/en/learning.quickstart.create-project.html

<VirtualHost *:80>
    ServerName quickstart.local
    DocumentRoot /path/to/quickstart/public

    SetEnv APPLICATION_ENV "development"

    <Directory /path/to/quickstart/public>
        DirectoryIndex index.php
        AllowOverride All
        Order allow,deny
        Allow from all
    </Directory>
</VirtualHost>


You have to add a baseUrl to your controller preferably in your bootstrap before you add the router.

$controller = Zend_Controller_Front::getInstance();
$controller->setBaseUrl('/subDirectory');

Note that this will add the base to all paths you are creating with the framework, i.e. the router. Lets say you have a collective /css folder you have to add the path for that either manually to any script method or create a subDirectory/css for that files.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜