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:
- 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.
- 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.
- 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.
- 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?
– Lucas Romano
Oops, I forgot that detail, version 3.0.6.
– Paulo Lima
Actually, the names of the Controllers, Models and Views folders should not be minute?
– Marcelo Diniz
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
– Paulo Lima