Home » Php » php – How to set baseUrl

php – How to set baseUrl

Posted by: admin July 12, 2020 Leave a comment


I want to set the baseurl in my project .
I am using zend framework .But i am new to zend framework and i don’t have any idea about how to set it?
Please help.
Thanks in advance

How to&Answers:

I think it automatically done by the zend-framework…..

try to echo…………

echo $this->baseUrl();

It will give you the desired answer…….


One way is through Bootstrap.php:

protected function _initSetupBaseUrl() {
    $controller = Zend_Controller_Front::getInstance();

Another way is through application.ini:

resources.frontController.baseUrl = /projects/myapp


From http://framework.zend.com/manual/en/zend.controller.request.html

$router     = new Zend_Controller_Router_Rewrite();
$controller = Zend_Controller_Front::getInstance();
           ->setBaseUrl('/projects/myapp'); // set the base url!
$response   = $controller->dispatch();


please try this. In your abcd.phtml ( zend framework ).

 <?php echo $this->baseUrl(); ?>