Git Product home page Git Product logo

moodle-tool_redirects's Introduction

Configurable redirects for Moodle

A very simple plugin which allows admin to set redirects based on url. Redirects can be from existing Moodle pages like from one course to another, or they can be 'vanity' urls from non existing urls into a page inside Moodle.

Installation

Step 1: Install the local module

Using git submodule:

git submodule add [email protected]:catalyst/moodle-tool_redirects.git admin/tool/redirects

OR you can download as a zip from github

https://github.com/catalyst/moodle-tool_redirects/archive/master.zip

Extract this into /var/www/yourmoodle/admin/tool/redirects

Then run the moodle upgrade as normal.

https://docs.moodle.org/en/Installing_plugins

Step 2: Apply core patches

This plugin requires MDL-66340, which was added in 3.8.

You can easily backport these patches in one line for 3.5, 3.6 and 3.7:

For Moodle 3.5:

git apply --whitespace=nowarn admin/tool/redirects/patch/core35.diff

For Moodle 3.6:

git apply --whitespace=nowarn admin/tool/redirects/patch/core36.diff

For Moodle 3.7:

git apply --whitespace=nowarn admin/tool/redirects/patch/core37.diff

Manual cherry-pick

In case the patches do not work due to an update to older Moodle branches (such as security updates), you can manually perform the cherry-picks.

For MDL-66340:

git cherry-pick 4ed105a9fd4c37e063d384ff155bd10c3bfbb303

If there are merge conflicts, ensure the lines that you are adding are consistent with the lines being added inside the patch files. Everything else can safely be ignored.

Once this has been performed, you can generate your own patch files using git format-patch. An example for Moodle 3.5 is below:

git format-patch MOODLE_35_STABLE --stdout > admin/tool/redirects/patch/new_core35.diff

Configuration

  • Navigate to Site Administration > Plugins > Admin tools > Redirects
  • Add rules. Each line should be a redirect rule like [php regex of local moodle URL to redirect from]=>[any URL to redirect to]. E.g. #/my/#=>/course/view.php?id=2
  • Enable or disable redirects for administrators

If you wish to use redirects for urls which do not exist, eg /some-vanity-url then your webserver needs to be configured to have Moodle handle error pages. Setup details are here:

https://docs.moodle.org/dev/Error_pages

Backdoor option for Admins

Admins can bypass redirect by adding noredirect=1 parameter to requested URL. E.g. http://moodle.example.com/my/?noredirect=1

Contributing and Support

Issues, and pull requests using github are welcome and encouraged!

https://github.com/catalyst/moodle-tool_redirects/issues

If you would like commercial support or would like to sponsor additional improvements to this plugin please contact us:

https://www.catalyst-au.net/contact-us

Crafted by Catalyst IT

This plugin was developed by Catalyst IT Australia:

https://www.catalyst-au.net/

Catalyst IT

moodle-tool_redirects's People

Contributors

dmitriim avatar brendanheywood avatar golenkovm avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.