Search code examples
phpcodeigniter

CodeIgniter Controller Case-Sensitive


I am doing my CI project on a localhost, and I never tried to upload it live. Now, this is the first time that I have uploaded my CI project into a web hosting and the URLs are case-sensitive.

www.mywebsite.com/content

The above code works on localhost, but it doesn't work on live server. This one works:

www.mywebsite.com/Content

As you notice, there's a capital C in it.

Should I change all the anchors that leads to the Content controller, or is there a way that when I enter www.mywebsite.com/content will be converted to www.mywebsite.com/Content ?


Solution

  • As you said you are using CI 3.

    Codeigniter change log says

    Changed filenaming convention (class file names now must be Ucfirst and everything else in lowercase). So you controllers and files name should be

    • My_controller (only M upper case rest lower case)

    • Public_controller

    • Application_controller

    • Foo_controller

    CI-2 was better in this case.

    Codeigniter Class and filename case sensitive on Linux (centos)

    Note 1:

    Windows hosting and Linux hosting has difference in file names.(Also Most of the Live Hosting providers (in server) will not give full freedom as working as localhost. There will be some strict modes and policies implemented in server for security reasons.)

    Note 2:

    The problem exist coz file name differs on Linux and Windows MyFile & myfile can not exist in a same path in Windows, but can on a Linux codeigniter url case sensitive issue