Two address to enter one moodle

Two address to enter one moodle

Ali Hastie -
回帖数:14
Particularly helpful Moodlers的头像

Hi

We having been working on Moodle within the College's Intranet (using a ISA server 2004) and would still like to enter within the College's Intranet as well as over the Internet.  Two addresses to enter the same location.

Is it possible to have two addresses within the config.php file for our single Moodle installation? would i need to ammend other files?

Please can someone help as we require Moodle internally as well externally.

Thanks, Ali.

回复Ali Hastie

本讨论区帖子已移除

本讨论区帖子的内容已移除,无法再访问。
回复删除的用户

Re: Two address to enter one moodle

Ali Hastie -
Particularly helpful Moodlers的头像

Hi Alan

thanks for the reply.  Spoke to our IT manager and he thinks that this solution would not work with the way the College has its setup.  Have you any other ideas?  would it not be possible to ammend the config.php (im not a php programmer) file to read the two addresses?

I read a post http://moodle.org/mod/forum/discuss.php?d=28416 where an individual recommended adding in the following code within the config file:

Original:
$CFG->wwwroot   = 'http://newtown-hs.powys.sch.uk/vle';

New:
$internal = FALSE;
if (substr($REMOTE_ADDR,0,3) == "10.") $internal = TRUE;
if (substr($REMOTE_ADDR,0,4) == "172.") $internal = TRUE;
if ($internal) {
$CFG->wwwroot = 'http://newtown-hs.powys.sch.uk/vle';
}
else  {
$CFG->wwwroot = 'https://schoolmail.newtown-hs.powys.sch.uk/vle';
}

I dont think the REMOTE_ADDR appeals to us.

Thanks again, Ali.

回复Ali Hastie

Re: Two address to enter one moodle

Steve Power -

Ali

In our config.php I have replaced the line like:

$CFG->wwwroot = 'http://newtown-hs.powys.sch.uk/vle';

with

if ($_SERVER['HTTP_HOST'] == "http://intranet/vle") {
$CFG->wwwroot = 'http://intranet/vle';
} else {
$CFG->wwwroot = 'http://newtown-hs.powys.sch.uk/vle';
}

We are using IIS on a Windows server if you are using Apache you may need to replace the $_SERVER['HTTP-HOST'] but I am not sure as I do not know Apache at all.

Regards
Steve

回复Ali Hastie

本讨论区帖子已移除

本讨论区帖子的内容已移除,无法再访问。
回复删除的用户

Re: Two address to enter one moodle

Ali Hastie -
Particularly helpful Moodlers的头像

Hi Alan

Many thanks for your reply.  We tried the code Steve kindly posted but only works internally!! I will pass your post onto our IT manager as he controls the DNS etc. and I will let you know what happens.

If anyone else has any ideas please post, this would be much appreciated.

Thanks again, Ali

回复Ali Hastie

Re: Two address to enter one moodle

Ali Hastie -
Particularly helpful Moodlers的头像

Hi again

spoke to our IT manager and he has ammended the config file as follows:

if ($_SERVER['HTTP_HOST'] = 'internal address'){
$CFG->wwwroot = 'external address';
}else{
$CFG->wwwroot = 'http://webserv:8011';}

We can view homepage externaly and internally but can not log in.  when we try to log in (as admin, teacher and student) we are taken to the white screen with an error stating: 400 bad request.

We can can also get so far into to moodle but eventually receive the 400 bad request error.  It looks like we are very close, has anyone any ideas??

Thanks, Ali.

回复Ali Hastie

Re: Two address to enter one moodle

Ali Hastie -
Particularly helpful Moodlers的头像

P.S.

When we try to login within the internal side we receive this error:

Attachment Blocked

You do not have the permissions required to open or download e-mail attachments from this computer. Contact your server administrator for details about your user permissions.

Please Help!

Ali.

回复Ali Hastie

Re: Two address to enter one moodle

Iñaki Arenaza -
Core developers的头像 Documentation writers的头像 Peer reviewers的头像 Plugin developers的头像
Let's suppose your internal moodle URL is 'http://internal.name.or.ip:1234/' and your external moodle URL is 'http://external.name.or.ip:8765'. Then you could have something like this:

if ($_SERVER['HTTP_HOST'] == 'internal.name.or.ip') {
    $CFG->wwwroot = 'http://internal.name.or.ip:1234/';
} else {
    $CFG->wwwroot = 'http://external.name.or.ip:8765/';
}

Watch out. The first line doesn't have neither 'http://' nor ':1234', but the other to do. This _is_ important.

Saludos. Iñalki.
回复Iñaki Arenaza

Re: Two address to enter one moodle

Ali Hastie -
Particularly helpful Moodlers的头像

Hi Iñalki

thanks for your post.  This code works internally (intranet) to the max but does not work externally (internet).  This is happening with another piece of software (Web Wiz forum)  where we can view within the Intranet but not able to view it over the Internet.

would it have to do with something concerning our server, router or firewall setup?  I know nothing about server etc setup as I leave this to our IT manager, but he is away at the moment.

Please can anyone help?

Thanks, Ali

回复Ali Hastie

Re: Two address to enter one moodle

Iñaki Arenaza -
Core developers的头像 Documentation writers的头像 Peer reviewers的头像 Plugin developers的头像
Would it have to do with something concerning our server, router or firewall setup?

Most probably yes.

Saludos. Iñaki.
回复Iñaki Arenaza

Re: Two address to enter one moodle

Ali Hastie -
Particularly helpful Moodlers的头像

Oh brother! our IT manager thinks that setup with mentioned hardware should not cause the problem!!

Has anyone out there had the same problem? I have looked through the forums for a few hours and have found certain areas but still unsure.

Please help!?

Thanks, Ali

回复Ali Hastie

Re: Two address to enter one moodle

M Moodley -
Try:

$CFG->wwwroot = 'http://'.$_SERVER['HTTP_HOST'].'/yourdirectory'


Note the ' (Not clear on the screen)
Works on my instalation from both in and out of school. Hope is works for you - let me know.
Not sure where I got this solution from.


Mervyn
回复M Moodley

Re: Two address to enter one moodle

Ali Hastie -
Particularly helpful Moodlers的头像

Hi Mervyn

thanks for your post but im not sure about: Note the ' (Not clear on the screen)

Sorry!

Ali

回复Ali Hastie

Re: Two address to enter one moodle

M Moodley -
Hi Ali:

Had my browser set to a low resolution and I could not see the apostiphy (') that I typed in!!

Mervyn