Welcome Guest, Not a member yet? Register   Sign In
config['base_url'] for access from public & private network
#1

[eluser]vclef[/eluser]
Hi,

I have an CI-based app that runs on a private IP space (192.168.*.*). This app can also be accessed from the internet (via a hole in the firewall).

My question is: What is the best way to set the config['base_url'] for this app? If I set it to the private IP, obviously it can't be accessed from the internet. If I set it to a public IP, the internal PCs would have to go outside the firewall then come back in. What do you recommend?

Thanks.
#2

[eluser]attos[/eluser]
To do this you need to remove the protocol and host name from config['base_url'].
If you have:

Code:
config['base_url'] = 'http://hostname/application';

use the following:

Code:
config['base_url'] = '/application';
#3

[eluser]Phil Sturgeon[/eluser]
The other popular favourite is to use:

Code:
$config['base_url'] = 'http://'.$_SERVER['SERVER_NAME'].'/application';

attos's approach will be easier if you use a port other than port 80.
#4

[eluser]vclef[/eluser]
Brilliant!!! Thanks.




Theme © iAndrew 2016 - Forum software by © MyBB