我正在将zend项目myproject
从本地主机部署到子目录www.subdirectory.com/~username/myproject
,即使我已经阅读了那里,我也面临很多问题在将zend项目从本地主机部署到子目录时,我已经尝试this从答案中获取但是它没有用。
问题是,当我将链接放在文件树上方并打开项目目录时,当我点击public时,它会将我重定向到默认模块的索引页面。我不能去任何其他页面
我无法控制apache2服务器。有没有办法部署项目,这是我的.htaccess
,index.php
和application.ini
下面的代码,任何答案或指导都会有所帮助
的.htaccess
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]
的index.php
// Define path to application directory
defined('APPLICATION_PATH')
|| define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application'));
// Define path to application directory
defined('PUBLIC_PATH')
|| define('PUBLIC_PATH', realpath(dirname(__FILE__)));
// Define application environment
defined('APPLICATION_ENV')
|| define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production'));
$paths = array(realpath(dirname(_FILE_) . '/../library'), '.');
set_include_path(implode(PATH_SEPARATOR, $paths));
/* Define the base URL */
define('URL_ADDRESS', "http://" . $_SERVER['HTTP_HOST']);
/** Zend_Application */
require_once 'Zend/Application.php';
// Create application, bootstrap, and run
$application = new Zend_Application(
APPLICATION_ENV,
APPLICATION_PATH . '/configs/application.ini'
);
$application->bootstrap()
->run();
的application.ini
[production]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1
includePaths.library = APPLICATION_PATH "/../library"
appnamespace = "Application"
resources.frontController.params.displayExceptions = 1
resources.layout.layoutPath = APPLICATION_PATH "/layouts/scripts/"
resources.view[] =
resources.frontController.moduleDirectory = APPLICATION_PATH "/modules"
resources.modules[] = ""
resources.layout.layoutPath = APPLICATION_PATH "/layouts/scripts/"
bootstrap.path = APPLICATION_PATH "/Bootstrap.php"
bootstrap.class = "Bootstrap"
resources.layout.layout = default
resources.frontController.moduleDirectory = APPLICATION_PATH "/modules"
resources.modules[] =
autoloaderNamespaces.Hyderlib = "Hyderlib_"
resources.layout.pluginClass= "Hyderlib_Controller_Plugin_ModuleLayout"
resources.view[] =
[staging : production]
[testing : production]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1
[development : production]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1
resources.frontController.params.displayExceptions = 1
resources.db.adapter = "pdo_mysql"
resources.db.params.host = "password"
resources.db.params.username = "password"
resources.db.params.password = "password"
resources.db.params.dbname = "password"
resources.db.isDefaultTableAdapter = true
答案 0 :(得分:1)
看看这个:.htaccess RewriteRule not working in subdirectory
我怀疑你必须编辑.htaccess以通过index.php转发除image / css / js之外的请求,而index.php不在同一目录中。
如果网络服务器根目录是〜/ username /,那么将.htaccess放在那里并更改
RewriteRule ^.*$ index.php [NC,L]
到
RewriteRule ^.*$ myproject/index.php [NC,L]
可能需要进行更多更改才能处理静态内容(其他重写)。