• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
CodeIgniter Routing works on MAMP NOT LAMP

#1
[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.

#2
[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.

#3
[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

#4
[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.

#5
[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?

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

#7
[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

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

#9
[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.

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


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


Users browsing this thread:
1 Guest(s)


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2017 MyBB Group.