Deploy ZF2 site to shared host

前端 未结 1 988
野的像风
野的像风 2020-12-29 17:39

When you deploy a Zend Framework website to a shared host, you usually cannot change the DocumentRoot to point at the public/ folder of the website. As a result the URL to t

相关标签:
1条回答
  • 2020-12-29 17:53

    Are you using the skeleton app?

    that seems a little over the top, surely it's lot simpler than that.

    move everything from public to the root

    change index.php

    <?php
    /**
     * This makes our life easier when dealing with paths. Everything is relative
     * to the application root now.
     */
    //chdir(dirname(__DIR__));
    chdir(__DIR__);
    
    // Setup autoloading
    require 'init_autoloader.php';
    
    // Run the application!
    Zend\Mvc\Application::init(require 'config/application.config.php')->run();
    

    Simples.

    If you are running an application like this you may want to block direct access to some of the Zend Framework folders using htaccess etc

    0 讨论(0)
提交回复
热议问题