My site runs mostly on an internal company LAN, but a number of people access it from externally.
The PC's on the LAN access the site directly using the private IP of the webserver: 192.168.10.96, so for them the $CFG->wwwroot variable is set to http://192.168.10.96/
People accessing the site externally use the fixed, public IP of our firewall / router; the router uses NAT to forward the requests to the local webserver.
I do this with the following code in /config.php:
if ( strstr($_SERVER['REMOTE_ADDR']), "192.168." !== ($_SERVER['REMOTE_ADDR'] )
{
$CFG->wwwroot = 'http://<public_ip_of_router>/';
} else {
$CFG->wwwroot = 'http://192.168.10.96/';
}
{
$CFG->wwwroot = 'http://<public_ip_of_router>/';
} else {
$CFG->wwwroot = 'http://192.168.10.96/';
}
Now the problem arises with images embedded within books etc have the entire URL kind of hardcoded into them. This means that images added by users on the LAN aren't visible to external users and vice versa. Does anybody know how I can get round this?
Thanks in advance,
Adam