从zend framework url中删除index.php

从zend framework url中删除index.php,php,.htaccess,zend-framework,indexing,Php,.htaccess,Zend Framework,Indexing,我正在使用zend framework开发一个模块,并使用zf create project创建了一个项目 命令 当我尝试使用ip/folder/controller/action访问url时,当我尝试使用ip/folder/index.php/controller/action访问url时,它给出了error not found error,我可以访问,但在这两种情况下我都无法包含js、css文件,我的htaccess是 RewriteEngine On RewriteCond %{REQUE

我正在使用zend framework开发一个模块,并使用zf create project创建了一个项目 命令

当我尝试使用
ip/folder/controller/action
访问url时,当我尝试使用
ip/folder/index.php/controller/action
访问url时,它给出了error not found error,我可以访问,但在这两种情况下我都无法包含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();

尝试将其添加到.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

尝试将其添加到您的.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替换为正确的路径

我只是将其添加到index.php的顶部:

$_SERVER["REQUEST_URI"] = str_replace('index.php', '', $_SERVER["REQUEST_URI"]);

这是

建议的另一种方法,我只是将其添加到index.php的顶部:

$_SERVER["REQUEST_URI"] = str_replace('index.php', '', $_SERVER["REQUEST_URI"]);

这是

建议的另一种方法,您需要启用模式重写。当您的web服务器没有看到.htaccess文件时,mod_rewrite已启用。你有Linux/Apache吗?你需要启用模式重写。当你的web服务器看不到.htaccess文件时,mod_rewrite已经启用。你有Linux/Apache吗?你能告诉我如何用示例配置安装路径吗?你也可以这样做:RewriteCond%{the_REQUEST}^[A-Z]{3,9}\/(*)index\.php(.*)HTTP/[NC]RewriteRule^index\.php(.*)$/$1[R=301,L]在任何情况下,它都应该指向index.php所在的位置。但是,后一个示例也应该包括您的用例。您能告诉我如何使用示例配置安装路径吗?您也可以这样做:RewriteCond%{The_REQUEST}^[A-Z]{3,9}\/(*)index\.php(.*)HTTP/[NC]RewriteRule^ index\.php(.*)/$1[R=301,L]在任何情况下,它都应该指向index.php所在的位置。然而,后一个例子也应该涵盖您的用例。