简体   繁体   English

默认控制器(在模块下)未在HMVC下加载,CodeIgniter,抛出404错误

[英]Default controller (under modules) not loading under HMVC, CodeIgniter, throws 404 err

Just migrated my CI from localhost to live. 刚从本地主机迁移了我的CI到生活。 Everything works fine on localhost with same settings. 使用相同的设置,在localhost上一切正常。

Here're the folder/file structure and contents of routes.php 这是route.php的文件夹/文件结构和内容

-application
--controllers
---Home.php
--modules
---specs
----controllers
-----Specs.php
----models
----views

$route['default_controller'] = 'Specs/index';
//$route['default_controller'] = 'Home/index';
$route['404_override'] = 'Errors/show_404';
$route['translate_uri_dashes'] = FALSE;

Both Specs and Home controllers have index method. Spec和Home控制器都具有索引方法。 When I load the home page url with Specs/index as default controller, I get 404 error. 当我将Specs / index作为默认控制器加载主页URL时,出现404错误。 But if I change the default controller to Home/index, it loads just fine. 但是,如果我将默认控制器更改为Home / index,则可以正常加载。 Strange. 奇怪。 Everything else works just fine on whole site. 其他所有内容在整个站点上都可以正常工作。 Can't figure out. 不知道。

The website is live but I'm not sure if providing url is allowed, so I'm including spaces in it. 该网站已经上线,但是我不确定是否允许提供网址,因此我在其中添加了空格。 It's unspecs dott comm. 这是未指定的dott comm。 Admin/Mods may please remove if url isn't allowed. 如果不允许使用url,则管理员/模块可能会删除。

Thanks for reading. 谢谢阅读。

Try this https://stackoverflow.com/questions/6529026/codeigniter.. . 试试这个https://stackoverflow.com/questions/6529026/codeigniter .. But better use standart folder for default controller /application/controllers 但最好将standart文件夹用于默认控制器/ application / controllers

I think you are doing mistake in routing, for HMVC it should be like that - 我认为您在路由时出错,对于HMVC,应该是这样的-

$route['default_controller'] = '<folder name>/<controller name>/<function name>';

$route['default_controller'] = 'specs/Specs/index';

Please follow this, hope it will work fine. 请按照此操作,希望它能正常工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM