Config.php and various subnets

Config.php and various subnets

by Jose Mª alconchel -
Number of replies: 0

I think I posted this in the wrong forum so I leave it here as well:

Dear All, I have a problem, I have a local network and a server with an DNS and

also a web server running moodle, the problem is that I have different subnets, and

I need that when the subnet where I'm accesin from is
 192.x.x.x the $CFG -> wwwroot variable needs to be http://192.168.1.213 when I

acces from outside I want it to be $CFG->wwwroot=http://mydomain; and when I access

from a 10.x.x.x subnet the $CFG->wwwroot=http://10.110.2.25

I tried creating an if condition into the config.php file, something like this:

[code]//if it is == my internet IP go to the localnetwork
if (getenv(HTTP_X_FORWARDED_FOR)==213.97.x.x){
       $CFG->wwwroot=http://10.110.2.25;
}else{
    $CFG->wwwroot=http://mydomain
}[/code]

but the problem is that it always goes into both options, and the browser looks

first for the 10.110... and after that looks for mydomain...


Any suggestions??

PD: Sorry for my English.

Average of ratings: -