最新我得到了一个用zend框架编写的应用程序1.它不是我的项目,但我必须改进一些功能。 现在我根目录中没有.htaccess和index.php。 当我去http://localhost/project时,我得到了结构。 下面我附上结构的屏幕。
在公共文件夹中我有这样的.htaccess:
SetEnv APPLICATION_ENV development
DirectoryIndex index.php
RewriteBase /
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]
这是我的应用程序/ configs / application.ini:
[production]
phpSettings.display_startup_errors = 0
phpSettings.display_errors = 0
includePaths.library = APPLICATION_PATH "/../library"
bootstrap.path = APPLICATION_PATH "/Bootstrap.php"
bootstrap.class = "Bootstrap"
appnamespace = "Application"
resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers"
resources.frontController.params.displayExceptions = 0
resources.layout.layoutPath = APPLICATION_PATH "/layouts/scripts/"
;ustawienia dostępu
resources.frontController.plugins.acl = "Application_Model_Acl"
resources.db.adapter = "PDO_MYSQL"
resources.db.params.host = "host"
resources.db.params.username = "user"
resources.db.params.password = "pass"
resources.db.params.dbname = "dbname"
resources.db.params.charset = "UTF8"
resources.db.isDefaultTableAdapter = true
autoloaderNamespaces[] = "ZendX"
autoloaderNamespaces[] = "PHPExcel"
;sesje
resources.session.save_path = APPLICATION_PATH "/../data/session"
resources.session.use_only_cookies = true
resources.session.remember_me_seconds = 864000
;Setup logger (file)
resources.log.file.writerName= Stream
resources.log.file.writerParams.stream= APPLICATION_PATH "/../log/main.log"
resources.log.file.filterName= Priority
resources.log.file.filterParams.priority = 7
resources.log.file.writerName= Stream
[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
我尝试过很多.htaccess,也在root中创建index.php,包括public / index.php,但仍然没有工作(返回404)。我也试过vhosts - 结果相同。我使用的是ubuntu 14 LTS和apache。
我应该使用哪种正确的.htaccess?