Welcome Guest, Not a member yet? Register   Sign In
CodeIgniter Routing works on MAMP NOT LAMP

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.

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


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";


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.

So just to confirm I understand.

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

I'm saying to try it. Should be quick to test...


I tried quickly changing to:

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


$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


Any more ideas CroNiX?

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

Thanks Narf, I will give that a go!

Theme © iAndrew 2016 - Forum software by © MyBB