Form action setting wrong path

Form action setting wrong path

by Nevin Reid -
Number of replies: 2

I'm hoping someone can help me out with this. We are running an old 2.1.2 version of Moodle what we want to upgrade. Due to issues I'm not going to bother to go into I have to keep this one alive but change the domain to an elearning subdomain. The site was sitting at xxx.com/moodle but now resides at elearning.xxx.com, pointing directly into that moodle folder.

I've updated the database tables and the config.php. Everything is working fine except for when a user or admin clicks to login to a course from the home page before they are logged in. The course will forward them to the login page (login/index.php), but when when the user clicks the form Login button the page logs them in then forwards to elearning.xxx.com/moodle/course/view.php?ID=123 instead of elearning.xxx.com/course/view.php?ID=123.

The same thing happens when I turn editing on for the front page and click the Save Changes button there. What do I need to set to make the form action realize that it doesn't need to go to that moodle/ folder any longer? I've searched through the php.ini, config.php, my apache.conf and found nothing set there. I'm running this on an inhouse server so everything is at my control.

Thanks.

Average of ratings: -
In reply to Nevin Reid

Re: Form action setting wrong path

by Mark Johnson -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Hi Nevin,

Some things to check:

  • Is the link generated by Moodle, or was it created by someone in e.g. a Label or Block? If the latter, the URL will have been stored in the database so will need changing in there.
  • What's the value of $CFG->wwwroot in config.php?
  • Have you configured your webserver with a redirect/rewrite rule to send users to the new URL if the enter the old one? Your rule might be faulty.
In reply to Nevin Reid

Re: Form action setting wrong path

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Have a read of Moodle migration. That explains what you have to do to change the URL of a Moodle site. After reading that, please ask about anything that is still unclear.