CodeIgniter 3 - HMVC - Problem with routes, Not Found or Failed to Load Session.php

4

My scenario is as follows:

I'm using CodeIgniter 3 with HMVC, while doing only local development, I had no problems with XAMPP with Windows, I went up to my test server which is an Ubuntu Server and then started the problems:

The routes stop working when uppercase letters are in the url , HMVC controllers are simply not found giving 404 error or failing to load Session.php which is a typical loading error of libraries / controllers and related.

I tried the following solutions:

  • Call URL in lowercase: It works, but it is not feasible to change the system completely and still fall into a situation where the user can type the url with a capital.
  • Change .HTACCESS file: By the tutorials I found you need to have access to http.conf to enable "RewriteMap lc int: tolower" and then do the rewrite rule, since on my server I only have access to .htaccess this did not solve.
  • Change the HMVC Loader: I tried, but I could not find a generic entry point where I could convert the base URL to lowercase before making the default class calls.
  • Change the variable $ _SERVER ['REQUEST_URI']: I am even embarrassed to expose this, but rather I arrived at that point as a last resort and gambiarras the part worked, in the first line of the standard index.php of CI I added : $ _SERVER ['REQUEST_URI'] = strtolower ($ _ SERVER ['REQUEST_URI']); and to my surprise it worked.
  • My questions are:

    A: Although I can solve my problem, I do not think it's good practice to change the $ _SERVER variable, how can I modify the MX_Loader so that it becomes definitely Case Insensitive?

    B: The HMVC documentation is not very clear in the file naming pattern, as they structure the 'modules' folder, my folder structure looks like this:

    www / application / modules /

    www / application / modules / system

    www / application / modules / system / Controllers /

    www / application / modules / system / Controllers / System.php

    www / application / modules / system / Controllers / Catalog.php

    www / application / modules / system / Controllers / Routes.php

    www / application / modules / system / Models /

    www / application / modules / system / Models / Sistema_model.php

    www / application / modules / system / Views /

    www / application / modules / system / Views / layout / structure.html

    www / application / modules / system / Views / leiaute / menu.html

    It may be that you are naming the files incorrectly and therefore generated the problem of question A for this reason I found it relevant to ask question B as well.

    Thank you in advance.

        
    asked by anonymous 16.05.2016 / 15:25

    1 answer

    1

    I have had problems related, but with naming files, In windows many times when naming the file with First letter in high box it simply does not consider, causing that when uploading this same file to a linux server stay with box low. But linux takes into account, because it considers the file in case sensitive .

    In Windows there are "codes" that are there only to make life easier for some beginner users, since as many forget the Caps Lock on, thousands of complaints would be made, since the vast majority of programs would not work because that the system would differentiate UpperCase from LowerCase.

    Final Summary: Take a look at the files that are on your linux server, and make sure they are even with the first letter in the upper case.

        
    20.05.2016 / 23:01