【问题标题】:CodeIgniter not routing requests past /index.php/ to correct controllerCodeIgniter 没有将请求通过 /index.php/ 路由到正确的控制器
【发布时间】:2017-04-05 17:31:27
【问题描述】:

CI 新手,因此假设误解可能是安全的...

我的文件夹结构是这样的

.
└── www
    ├── appthing
    │   └── V5
    │       ├── application
    │       │   ├── config
    │       │   ├── controllers
    │       │   │   ├── api
    │       │   │   └── V1
    │       │   │       ├── settings.php
    │       │   ├── ...
    │       │   └── views
    │       └── system
    └── vhosts
        └── appthing
              index.php
              .htaccess 

htaccess

我在 /etc/apache2/sites-available/000-default.conf 中的 apache 配置如下所示:

DocumentRoot /var/www/www/vhosts/appthing

 <Directory "/var/www/www/vhosts/appthing">
    AllowOverride All
 </Directory>

当我导航到ipaddress/index.php 时,我得到一个身份验证错误,这很好,因为我至少可以访问 index.php 文件。但是,如果我尝试转到 index.php/settings,我会收到 CI 404 错误。相同的代码在我的计算机上运行(OS X,目前正试图将其放在 AWS Ubuntu 16 实例上),因此 CI 语义没有问题。

【问题讨论】:

  • 配置/路由中的默认控制器是什么$route['default_controller'] = 'welcome'; 将其更改为您的控制器位置/api/controller_name/function_name_if_you_want_function_as_Default

标签: php apache .htaccess codeigniter


【解决方案1】:

我认为您需要将 Documentroot 设置为 /var/www/www/appthing/V5。通常你的 CI 项目中应该有 index.php 文件,它将把你重定向到一个 home (standard = welcome.php) 控制器。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-03-30
    • 1970-01-01
    • 2012-04-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多