子文件夹中的访问控制器时出现403错误(CodeIgniter)

时间:2012-05-30 04:20:46

标签: .htaccess codeigniter controller http-status-code-403 subdirectory

这是我的应用程序框架:

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 /后端
  • mysite.local /后端/ some_backend_controller

但是,使用URL中的index.php一切都很好。

  • mysite.local / index.php的/后端
  • mysite.local / index.php的/后端/ some_backend_controller

我在这里错过了什么吗?

谢谢你的时间!

2 个答案:

答案 0 :(得分:0)

检查后端文件夹的权限。它可能会阻止Web服务器读取目录的实际内容。 许可应该允许每个人阅读

答案 1 :(得分:-2)

你的config / routes.php是什么样的?可能会尝试这样的事情:

$route['backend'] = "backend/controller/method";