CodeIgniter Forums
problem with routes half working - 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: problem with routes half working (/showthread.php?tid=19215)



problem with routes half working - El Forum - 06-01-2009

[eluser]giovannidc[/eluser]
I set up routes my application and they were working fully on my localhost. When I moved my site over to my server my routes only half work. Routes don't want to work for controllers that are placed in sub folders. Does anyone know why its doing that?

Here is an example of how I set it up:

This works:
Code:
$route['conferencing-rates'] = "content/conferencing_rates";
$route['image-gallery'] = "content/image_gallery";

This doesn't work (controllers are in the admin folder):
Code:
$route['admin'] = "admin/Data";
$route['admin/login'] = "admin/User/login";

What does work if write it all out the usual way eg. admin/User/login

What I have tried is renaming folders and disabling url rewrite.

If anyone knows what I can do, it would be awesome thanks Smile


problem with routes half working - El Forum - 06-01-2009

[eluser]TheFuzzy0ne[/eluser]
In you're config.php file, try out the different URI protocols until you find one that works.


problem with routes half working - El Forum - 06-01-2009

[eluser]giovannidc[/eluser]
Tried all of them and none of them worked. Any other ides?


problem with routes half working - El Forum - 06-01-2009

[eluser]TheFuzzy0ne[/eluser]
The problem is with your file case. You're no doubt running on a Linux server, and file case must be all lowercase, and you're routes should match.


problem with routes half working - El Forum - 06-01-2009

[eluser]giovannidc[/eluser]
Thank you. That was it. I was the impression that you call the class that starts with an uppercase letter and not the filename that starts with a lower case. And the only reason why my root controllers worked was because I accidental forgot to the same.

Thank you again Smile


problem with routes half working - El Forum - 06-01-2009

[eluser]TheFuzzy0ne[/eluser]
Filename are always lowercase, unless you're extending a library, or helper, in which case this would be the syntax used:

Code:
MY_Controller.php # extending a library - The prefix is as written in the config.php file, and the first character after the prefix is uppercase.
MY_form_helper # extending a helper - The prefix is as it is written in your config.php, and the rest is entirely lower case.

I think these are the only instances where you need to use any uppercase characters in your file names. Smile


problem with routes half working - El Forum - 06-01-2009

[eluser]giovannidc[/eluser]
thanks. I just meant for example:
content.php:
Code:
<?php
  class Content extends Controller{
    function Content()
    {
      parent::Controller();
    }
?>

the filename is lower case but the class starts with higher case in the file.

But thanks for clearing it all up Smile


problem with routes half working - El Forum - 06-01-2009

[eluser]TheFuzzy0ne[/eluser]
PHP is case insensitive, so it doesn't matter what case you name the class itself, it's only for consistency and ease of reading that we follow the naming conventions, and name classes using underscores for spaces, and make the first character uppercase.

The file name is the really important one, as Linux is case-sensitive, but Windows is not.