I've installed latest Apache, PHP7 and codeigniter in a Ubuntu 17.04 server. I've assigned it a local IP, let's say 10.20.30.40 .
This codeigniter app should work locally and also should work from outside (internet).
There is also an intermediary nginx server (which I cannot access) that redirects everything from outside (Internet) to my server, so I've made some test and debugging with xdebug:
http://10.20.30.40/ciapp/index.php/test
works fine
$_SERVER['REQUEST_URI'] = string '/ciapp/index.php/test'
http://www.subdomain.company.xxx/ciapp/index.php/test
does not work (it throws the codeigniter 404 page)
$_SERVER['REQUEST_URI'] = string '//ciapp/index.php/test'
(note the double slash preceding)
http://10.20.30.40//ciapp/index.php/test
(note the double slash on purpose) didn't work, got the CI's 404
Is there something I could do with REQUEST_URI so it works from outside? Or maybe it is another problem...?
PS: config suggested elsewhere:
$config['base_url'] = $_SERVER['HTTP_HOST'] == '10.20.30.40' ? 'http://10.20.30.40/ciapp/' : 'http://www.subdomain.company.xxx/ciapp/';
Finally solved by setting uri_protocol = PATH_INFO
file: application/config/config.php
$config['base_url'] = $_SERVER['HTTP_HOST'] == '10.20.30.40' ? 'http://10.20.30.40/ci/' : 'http://www.subdomain.company.xxx/ciapp/';
$config['index_page'] = '';
$config['uri_protocol'] = 'PATH_INFO';
file: .htaccess (to remove index.php from url)
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
Now it is working perfect locally and loading from Internet