1

这是我的应用程序框架:

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

我在这里错过了什么吗?

谢谢你的时间!

4

2 回答 2

0

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

于 2012-05-30T14:30:11.373 回答
-2

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

$route['backend'] = "backend/controller/method";
于 2012-05-30T11:41:14.817 回答