我想在多个域上运行Zend Framework。在1个域上,我有整个应用程序,有2个不同的application.ini,每个域一个。 在另一个域我只复制了公用文件夹。但我似乎无法让第二个域名在index.php中运行,希望你们可以帮助我。
<?php
header("Content-type: text/html; charset=utf-8");
// Define path to application directory
defined('APPLICATION_PATH')
|| define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../../DOMAIN_WITH_APPLICATION_MAP/application'));
// Define application environment
defined('APPLICATION_ENV')
|| define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'development'));
// Ensure library/ is on include_path
set_include_path(implode(PATH_SEPARATOR, array(
realpath(APPLICATION_PATH . '/../../DOMAIN_WITH_APPLICATION_MAP/library'),
get_include_path(),
)));
/** Zend_Application */
require_once 'Zend/Application.php';
require_once 'Zend/Loader/Autoloader.php';
$loader = Zend_Loader_Autoloader::getInstance ();
$loader->setFallbackAutoloader ( true );
$loader->suppressNotFoundWarnings ( false );
// Create application, bootstrap, and run
$application = new Zend_Application(
APPLICATION_ENV,
APPLICATION_PATH . '/configs/application2.ini'
);
$application->bootstrap()
->run();
答案 0 :(得分:0)
您需要更新服务器配置。如果您使用的是apache,则需要使用ServerAlias,它允许您将内容从主域映射到别名域。示例:
<VirtualHost *:80>
ServerName www.mysite.co.uk
ServerAlias www.mysite2.co.uk www.mysite3.co.uk
</VirtualHost>