brendanheywood / moodle-local_cleanurls

Lets drag Moodle's url structure into this century...
36 stars 24 forks source link

Custom Menu Item Links Incorrect #96

Open nyanginator opened 7 years ago

nyanginator commented 7 years ago

Hi, haven't downloaded the updated version until recently. The old version (2016102000) was working pretty great for me, thanks for all the hard work! In the current version, using Moodle's suggested example custom menu (under Appearance > Theme Settings):

Moodle community|https://moodle.org
-Moodle free support|https://moodle.org/support
-Moodle Docs|http://docs.moodle.org|Moodle Docs
-Moodle development|https://moodle.org/development
Moodle.com|http://moodle.com/

The links I get on a course page are:

http://localhost/testsite/courses/course/My+Test+Course#
https://moodle.org/testsite/courses/
http://docs.moodle.org/testsite/courses/
https://moodle.org/testsite/courses/
http://moodle.com/testsite/courses/

My Moodle installation is in /opt/lampp/htdocs/testsite/courses. So basically, everything after the domain in the URL is replaced with the webroot's subdirectory path to the Moodle installation. I think the first link is correct, as it's just a menu item to click to show the dropdown menu. But the other links are lost. Thank you ahead of time for any insight.

brendanheywood commented 6 years ago

@nyanginator what is your wwwroot?

nyanginator commented 6 years ago

$CFG->wwwroot = 'http://localhost/testsite/courses';

ajwsert commented 6 years ago

Yes, I have just noticed that and was going to open an issue but then I found this one. It happens like OP described, actually worse. All URLs are overwritten (yes overwritten) with the root path after the domain.

E.g. for me I have these items, Moodle is installed in a subfolder moodle (left are originals, right are what I get when Clean URLs is on):

https://moodle.org/support | https://moodle.org/moodle/t
https://moodle.org/development | https://moodle.org/moodle/pment
http://anotherdomainmasked/ | http://anotherdomainmasked/moodle/

As it can be seen in https://moodle.org/moodle/pment it gets overwritten. In fact, I had noticed it when I had that debugging to error log enable. This is what I got in it (stripped stuff to keep it short):

Found cached: https://moodle.org/development => https://moodle.org/moodle/pment, referer: 
Found cached: https://tracker.moodle.org => https://tracker.moodle.org/moodle/, referer: 
Found cached: https://docs.moodle.org => https://docs.moodle.org/moodle/, referer: 
Found cached: https://moodle.com => https://moodle.com/moodle/, referer: 
Found cached: http://anotherdomainmasked => http://anotherdomainmasked/moodle/, referer: 
Found cached: # => /moodle/#, referer: 

Even weird with emails. I get this in the profile page: mailto:/moodle/9n@localhost.local. It should bemailto:admin@localhost.local.