CodeIgniter Forums
CodeIgniter Routing works on MAMP NOT LAMP - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: CodeIgniter Routing works on MAMP NOT LAMP (/showthread.php?tid=61203)

Pages: 1 2 3


CodeIgniter Routing works on MAMP NOT LAMP - El Forum - 10-15-2014

[eluser]andyscraven[/eluser]
I am having a weird issue with routing as follows when I try and go to the homepage of a domain. All other paths work fine.

$route['default_controller'] = "Home";
$route['404_override'] = '';

The Controller is called Home.php.

works fine on MAMP but when I copy it across to my server I get a weird page from Cloudflare saying:

The page you are looking for cannot be found.


If I put:

$route['404_override'] = 'Home';

it goes to my home page fine. I am wanting to send all unknown urls to a 404 page.

On MAMP it works exactly as it should with the 404_override empty.

Any ideas?

Thanks everyone.



CodeIgniter Routing works on MAMP NOT LAMP - El Forum - 10-15-2014

[eluser]CroNiX[/eluser]
try lowercase "home". Also make sure both apache servers are set up the same if expected to work the same on both.


CodeIgniter Routing works on MAMP NOT LAMP - El Forum - 10-15-2014

[eluser]andyscraven[/eluser]
Hi

Thanks for your reply.

I am confused though as your docs have Uppercase Controllers.

Is there a config in apache or PHP that I need to check?

Also, the routing works for that Home controller for other Functions, such as:

$route["$merchant"] = "Home/merchant";

Andy


CodeIgniter Routing works on MAMP NOT LAMP - El Forum - 10-15-2014

[eluser]CroNiX[/eluser]
Yes, class definitions are capitalized, but when used it's lower case. I'd just use lower case in your code. Different hosting environments are case sensitive while others are not, so it's best to just use lower case to be consistent. Does that code with the uppercase route work in the other environment? You're saying things work fine and not in the other, so this is probably why.


CodeIgniter Routing works on MAMP NOT LAMP - El Forum - 10-15-2014

[eluser]andyscraven[/eluser]
So just to confirm I understand.

You are saying change all controller references in routes.php to lowercase and that is all?


CodeIgniter Routing works on MAMP NOT LAMP - El Forum - 10-15-2014

[eluser]CroNiX[/eluser]
I'm saying to try it. Should be quick to test...


CodeIgniter Routing works on MAMP NOT LAMP - El Forum - 10-15-2014

[eluser]andyscraven[/eluser]
Hi

I tried quickly changing to:

$route['default_controller'] = "home";

and

$route['404_override'] = '';

but the same thing happened.

I had left all the others as "Home..." as they seem to work anyway and the Controller is called Home.php

Andy


CodeIgniter Routing works on MAMP NOT LAMP - El Forum - 10-16-2014

[eluser]andyscraven[/eluser]
Any more ideas CroNiX?


CodeIgniter Routing works on MAMP NOT LAMP - El Forum - 10-16-2014

[eluser]Narf[/eluser]
Route configuration doesn't matter, it's the filename that matters - rename from Home.php to home.php and you're done.


CodeIgniter Routing works on MAMP NOT LAMP - El Forum - 10-16-2014

[eluser]andyscraven[/eluser]
Thanks Narf, I will give that a go!