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

Asked

Viewed 1,018 times

4

My scenario is this::

I am 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 stopped working when there are uppercase letters in the url, HMVC controllers are simply not found error 404 or failing to load Session.php which is a typical library/controller loading error and the like.

I tried the following solutions:

  1. Call URL in lower case: It works, but it is not possible to change the system completely and still fall into a situation where the user can type the url capitalized.
  2. Change file . HTACCESS: By the tutorials I found you need to have access to http.conf to enable "Rewritemap Lc int:tolower" and then make the rewrite rule, since on my server I only have access to . htaccess that didn’t solve me.
  3. Change HMVC Loader: I tried, but couldn’t find a generic entry point where I could convert the base URL to lowercase before making the default class calls.
  4. Change the $_SERVER['REQUEST_URI variable']: I am ashamed to expose this, but yes I arrived at this point as a last resort and gambiarras the part worked, in the first line of the index.php standard CI added: $_SERVER['REQUEST_URI'] = strtolower($_SERVER['REQUEST_URI']); and to my surprise it worked.

My doubts are:

A: Although I can solve my problem, I don’t believe it is good practice to change the $_SERVER variable, as I can 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 is like this:

www/application/modules/

www/application/modules/system

www/application/modules/system/Controllers/

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

www/application/modules/system/Controllers/Catalogo.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/layout/menu.html

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

Thanks in advance.

  • Which version of the IC you are using?

  • Oops, I forgot that detail, version 3.0.6.

  • Actually, the names of the Controllers, Models and Views folders should not be minute?

  • In the standard CI mvc yes, I do not remember in HMVC, I stopped using it, because I found another way to work with the modules of my system, but thanks for the support

1 answer

1

I’ve had problems related, only with file naming, In windows often when you name the file with First letter in high box it simply does not consider, causing when climbing this same file to a linux server to get low box. But linux takes into account, as it considers the files in case sensitive.

In Windows there are "codes" that are there only to facilitate the life of some kind of beginner user, since as many forget the Caps Lock on, thousands of complaints would be made, because the vast majority of programs would not work , because 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 high box.

  • This is not my problem, I checked it on the linux server and ta everything according, the case are the route controls of the plugin hmvc, for example in the original CI using (:?) if I am not mistaken, it accepts route case insensitive, but in hmvc not.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.