Reputation: 199
I am deploying a zend project myproject
from a local host to a sub-directory www.subdirectory.com/~username/myproject
, i am facing many problems even though i have read that there is no so much to change to when deploying zend project from local host to sub directory i have tried this which i took from an answer but it didn't work.
The problem is when I put the link above a file tree with the directory of the project opens, and when I click on public it redirect me to the index page of the default module. and I cant go to any other page
I have no control on the apache2 server. is there a way to deploy the project and this is my code below for the .htaccess
,index.php
, and application.ini
any answers or guidance will be helpful
.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
Upvotes: 4
Views: 603
Reputation: 3602
Take a look at this: .htaccess RewriteRule not working in subdirectory
I suspect you have to edit the .htaccess to forward requests other than image/css/js through index.php which is not located in the same directory.
If the webserver root is ~/username/ then put .htaccess in there and change
RewriteRule ^.*$ index.php [NC,L]
to
RewriteRule ^.*$ myproject/index.php [NC,L]
More changes may need to be made to handle the static content (other rewrites).
Upvotes: 1