我正在使用 zend 框架开发一个模块,并且我已经使用 zf create project 创建了一个项目命令
I am developing a module using zend framework and I have created a project using zf create project command
当我尝试使用 ip/folder/controller/action
访问 url 时,当我尝试使用 ip/folder/index.php/controller/访问时,它给出了错误未找到错误action
我可以访问,但在这两种情况下我都无法包含 js、css 文件,我的 htaccess 是
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]
和 index.php 是
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();
尝试将其添加到您的 .htaccess 中:
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]
用正确的路径替换/path/to/your/installation
Replace /path/to/your/installation with the correct path
这篇关于从 Zend 框架 url 中删除 index.php的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!