我正在开发一个模块使用Zend Framework,我已经使用ZF创建项目创建项目 命令
当我尝试使用访问网址 IP /文件夹/控制器/动作
它是给错误未找到错误,当我尝试使用访问 IP /folder/index.php/controller/action
我能够访问,但我无法包括的js,在这两种情况下,CSS文件和我的htaccess是
RewriteEngine叙述上
的RewriteCond%{} REQUEST_FILENAME -s [OR]
的RewriteCond%{} REQUEST_FILENAME -l [OR]
的RewriteCond%{} REQUEST_FILENAME -d
。重写规则^ * $ - [NC,L]
重写规则^ * $的index.php [NC,L]
和index.php的是
< PHP
//定义路径的应用程序目录
定义(APPLICATION_PATH)
||定义(APPLICATION_PATH,真实路径(目录名(__ FILE__)/应用程序));
//定义应用程序环境
定义(APPLICATION_ENV)
||定义(APPLICATION_ENV',(GETENV('APPLICATION_ENV)
? GETENV('APPLICATION_ENV):生产));
//确保库/是的include_path
set_include_path(破灭(PATH_SEPARATOR,
阵列(真实路径(APPLICATION_PATH。/库),get_include_path()
)));
/ ** * Zend_Application /
require_once'的Zend / Application.php;
//创建应用程序,引导,并运行
$应用=新Zend_Application(
APPLICATION_ENV,
APPLICATION_PATH。 /configs/application.ini
);
$应用程序 - >引导() - >运行();
解决方案
尝试添加到您的.htaccess:
的RewriteCond%{THE_REQUEST} ^ [AZ] {3,9} /([^/]+/)*index.php
重写规则^ index.php文件(。*)$ /路径/要/你/安装$ 1 [R = 301,L]
替换/路径/要/你/安装的正确路径
I am developing a module using zend framework and I have created a project using zf create project command
when i try to access the url using ip/folder/controller/action
it is giving error not found error when i try access using ip/folder/index.php/controller/action
i am able to access but i am unable to include js,css files in both cases and my htaccess is
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]
and the index.php is
<?php
// Define path to application directory
defined('APPLICATION_PATH')
|| define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/application'));
// Define application environment
defined('APPLICATION_ENV')
|| define('APPLICATION_ENV', (getenv('APPLICATION_ENV')
? getenv('APPLICATION_ENV') : 'production'));
// Ensure library/ is on include_path
set_include_path(implode(PATH_SEPARATOR,
array(realpath(APPLICATION_PATH . '/library'), get_include_path(),
)));
/** 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();
解决方案
Try adding this to your .htaccess:
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9} /([^/]+/)*index.php
RewriteRule ^index.php(.*)$ /path/to/your/installation$1 [R=301,L]
Replace /path/to/your/installation with the correct path