【发布时间】:2012-06-04 07:31:42
【问题描述】:
这是我的应用程序框架:
application
controllers
backend
[backend_controllers_here]
[frontend_controllers_here]
models
[shared_models_for_both_backend_and_frontend]
views
backend
[backend_views_here]
[frontend_views_here]
...
system
index.php
.htaccess
这是我的 .htaccess 文件内容:
Options -Indexes
Options +FollowSymLinks
# Set the default file for indexes
# DirectoryIndex index.php
<IfModule mod_rewrite.c>
# activate URL rewriting
RewriteEngine on
# do not rewrite links to the documentation, assets and public files
RewriteCond $1 !^(images|assets|uploads|captcha)
# do not rewrite for php files in the document root, robots.txt or the maintenance page
RewriteCond $1 !^([^\..]+\.php|robots\.txt)
# but rewrite everything else
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>
<IfModule !mod_rewrite.c>
# If we don't have mod_rewrite installed, all 404's
# can be sent to index.php, and everything works as normal.
ErrorDocument 404 index.php
</IfModule>
当我在地址栏输入类似这样的内容(对于前端)时,这没有错:
- mysite.local
- mysite.local/index.php
- mysite.local/index.php/frontend_controller
- mysite.local/frontend_controller
但是对于后端,我在尝试访问时遇到了 403 错误:
- mysite.local/backend
- mysite.local/backend/some_backend_controller
但是,在 URL 中使用 index.php 一切都很好。
- mysite.local/index.php/backend
- mysite.local/index.php/backend/some_backend_controller
我错过了什么吗?
感谢您的宝贵时间!
【问题讨论】:
标签: .htaccess codeigniter controller http-status-code-403 subdirectory