1
votes

I am using HMVC with Codeigniter-3.x using MX for both backend and frontend. whole project are in a subdomain. Frontend is working well in both localhost and online domain. In localhost backend is also working well. But backend not working on online domain. the url from the modules are 404.

I have used to define base url as

$config['base_url'] = ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == "on") ? "https" : "http");
$config['base_url'] .= "://".$_SERVER['HTTP_HOST'];
$config['base_url'] .= str_replace(basename($_SERVER['SCRIPT_NAME']),"",$_SERVER['SCRIPT_NAME']);

Is there any routing solution for hmvc loader? My project structure is here.


mydomain.com
    /subdomain
          /system
          /asset
          /application
                /controllers
                /models
                /views
                /modules
                     /module_1
                            /controllers
                            /models
                            /views
                /third_party
                     /MX
                /core
                /helper
                /config
                /....
          /backend
                /asset
                /application
                      /controllers
                      /models
                      /views
                      /modules
                            /module_1
                                  /controllers
                                  /models
                                  /views
                      /third_party
                            /MX
                      /core
                      /helper
                      /config
                      /....
1
Try removing SCRIPT_NAME line from setting base_url but also set trailing slash after HTTP_HOST . - Tpojka
That's also not working. Even I use static base_url like $config['base_url'] = "example.com/subdomain/backend"; for my backend project. Same hassle. - Nirjhar Mandal
base_url needs scheme, too (i.e. http://example.com). - Tpojka
With trailing slash http://example.com/. - Tpojka
I don't what are you trying to suggest me. Though I've used both as base url; It doesn't work for me. anyway thank you... - Nirjhar Mandal

1 Answers

0
votes

I think it is good practice to use single application folder.

For backend you may create a module name with Backend/Admin and keep your controllers their. Hope it will work fine...