我正在使用zend框架开发模块,我使用zf create project创建了一个项目 命令
当我尝试使用ip/folder/controller/action
访问网址时,当我尝试使用ip/folder/index.php/controller/action
进行访问时,我发现错误未找到错误我能够访问但我无法在两者中包含js,css文件案件和我的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是
<?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();
答案 0 :(得分:1)
尝试将此添加到.htaccess:
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9} /([^/]+/)*index.php
RewriteRule ^index.php(.*)$ /path/to/your/installation$1 [R=301,L]
使用正确的路径替换/ path / to / your / installation
答案 1 :(得分:0)
我只是将它添加到index.php的顶部:
$_SERVER["REQUEST_URI"] = str_replace('index.php', '', $_SERVER["REQUEST_URI"]);
建议的其他方法