0

Just migrated my CI from localhost to live. Everything works fine on localhost with same settings.

Here're the folder/file structure and contents of routes.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. When I load the home page url with Specs/index as default controller, I get 404 error. But if I change the default controller to Home/index, it loads just fine. 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. Admin/Mods may please remove if url isn't allowed.

Thanks for reading.

Pradeep
  • 9,667
  • 13
  • 27
  • 34
Kabeirs
  • 3
  • 3

2 Answers2

0

Try this https://stackoverflow.com/questions/6529026/codeigniter... But better use standart folder for default controller /application/controllers

zahorniak
  • 135
  • 4
  • The article you referred to deals with sub-folders within controllers folder which is not exactly same as this question. I would've used standard folders as you suggested if the same setup didn't work on localhost but it does. Also, if we have to use standard folder, the whole purpose of having HMVC is defeated. Thanks anyway. Appreciate your time and effort. – Kabeirs Jul 12 '18 at 16:16
0

I think you are doing mistake in routing, for HMVC it should be like that -

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

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

Please follow this, hope it will work fine.

Sorav Garg
  • 1,116
  • 1
  • 9
  • 26
  • Okay. Setting that actually worked but why would localhost work **without** it? I've never had any problems on localhost without setting the folder first. Localhost version of this site without folder still works as I write this. Any explanations? Thanks for the fix though. Appreciate it. – Kabeirs Jul 12 '18 at 15:23
  • Upvoted but it isn't showing because of my low reputation. Although the solution worked but I'm not sure if this is the correct fix. – Kabeirs Jul 12 '18 at 15:43
  • Thanks, let me know if you need any other help. – Sorav Garg Jul 13 '18 at 06:28
  • Can you help me out with this one, https://stackoverflow.com/questions/51262040/how-to-convert-codeigniter-urls-into-user-friendly-ones/51266580?noredirect=1#comment89524977_51266580 – Kabeirs Jul 13 '18 at 18:09
  • Hi, I replied to that post. Please check it. – Sorav Garg Jul 16 '18 at 07:45