【发布时间】:2014-03-06 17:01:13
【问题描述】:
我正在使用 zend 框架 1.12 开发一个项目 为了在 index.php 上重定向域,我使用了两个 .htaccess,一个在根目录中,一个在公共文件夹中
我的问题是,当我输入域名时,它应该在索引控制器上重定向。
文件夹结构如下
application
--configs
----application.ini
library
--Zend
public
--css
--js
--index.php
--.htaccess
.htaccess
下面是写在根.htaccess文件中
RewriteEngine on
RewriteRule (.*) public/$1
下面是写在public/.htaccess文件中
RewriteEngine On
# The following rule tells Apache that if the requested filename
# exists, simply serve it.
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
# The following rewrites all other queries to index.php. The
# condition ensures that if you are using Apache aliases to do
# mass virtual hosting, the base path will be prepended to
# allow proper resolution of the index.php file; it will work
# in non-aliased environments as well, providing a safe, one-size
# fits all solution.
RewriteCond %{REQUEST_URI}::$1 ^(/.+)(.+)::$
RewriteRule ^(.*)$ - [E=BASE:%1]
RewriteRule ^(.*)$ %{ENV:BASE}index.php [NC,L]
application/configs/application.ini
[production]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1
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 = 1
resources.frontController.moduleDirectory = APPLICATION_PATH "/modules"
resources.layout.layoutPath = APPLICATION_PATH "/layouts/scripts/"
resources.frontController.baseUrl = "/"
resources.session.remember_me_seconds = 864000
[staging : production]
[testing : production]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1
resources.db.adapter = "PDO_MYSQL"
resources.db.params.host = "localhost"
resources.db.params.username = "root"
resources.db.params.password = "root123"
resources.db.params.dbname = "labs"
resources.db.isDefaultTableAdapter = true
[development : production]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1
resources.frontController.params.displayExceptions = 1
resources.db.params.profiler.enabled = true
resources.db.params.profiler.class = Zend_Db_Profiler_Firebug
以上设置一切正常。但我无法在根目录中创建任何其他文件夹。 如果我创建名为 abc 的新文件夹并像 domain.com/abc 一样访问,我将无法访问。它将这视为控制器操作。
请帮助我如何解决这个问题。 为了解决这个问题,我尝试将 index.php 放在公共文件夹的根目录中。之后没有任何工作正常。
【问题讨论】:
标签: php mysql .htaccess zend-framework mod-rewrite