I searched for this problem but I was unable to find an answer.
Here is the background:
On the moodle config file, I used to have the following value:
$CFG->wwwroot = 'https://mysite.edu/moodle';
I then needed to charge for course subscription and hence decided to make the entire site secure, I then replaced the above value on my config file as follows:
$CFG->wwwroot = 'https://mysite.edu/moodle';
In short, I replaced http for https. I initially, it all seemed to be working smoothly until I realized that I was unable to install plugins. Every time I wanted to do so, it shows me the pesky "Incorrect access detected, this server may be accessed only through "[address]" address, sorry." It then tries to redirect me in a loop, never being able to leave that page.
Strangely enough, this also occurs when I click on the logo link, even though the actual link appears to be correct when I mouse over the logo. It points me to the above error message and never redirects me, or I should say, it does try to redirect me every 3 seconds, but it appears to be on a loop.
Somehow, I presume that there are links that attempts to direct me to the old URL. I thus made sure to clear all caches from the site and the theme, to no avail. I even looked for all references to the OLD URL addresses on phpMyAdmin, and I replaced them with the NEW URL, and that still did not work. I also searched for any reference to the OLD URL on the installation files, and there are absolutely none. So this is really baffling me.
As a last note, I should mention that I already tried to modify the file lib/setuplib.php by replacing the line:
redirect($CFG->wwwroot, get_string('wwwrootmismatch', 'error', $CFG->wwwroot), 3);
for
redirect($CFG->wwwroot, get_string('wwwrootmismatch', 'error', $CFG->wwwroot), 0);
and did not work either because I was receiving an error message form Firefox to the effect that the page could never load.
Can anyone shed any light to this mystery?