Comments (6)
I'm gonna reopen this and treat this as a documentation task to update the readme with an example of this
from moodle-tool_redirects.
hey @VOOM108
It should just work if https://campus.mymoodlesite.com/importantquiz is your moodle page that loads configs and has after_config callback fired, otherwise it's out of scope for that plugin sorry.
from moodle-tool_redirects.
If that page doesn't exist at all, but you have setup Moodle to be the handler for your error pages then this should all work.
The setup for this can be found here:
https://docs.moodle.org/dev/Error_pages
ie browser visits
/importantquiz
this doesn't exist and so nginx or apache routes this to the error page at:
/error/index.php
From this page the after_config hook fires and does the detection and then redirects to wherever you want it to based on config
from moodle-tool_redirects.
If that page doesn't exist at all, but you have setup Moodle to be the handler for your error pages then this should all work.
The setup for this can be found here:
https://docs.moodle.org/dev/Error_pages
ie browser visits
/importantquiz
this doesn't exist and so nginx or apache routes this to the error page at:
/error/index.php
From this page the after_config hook fires and does the detection and then redirects to wherever you want it to based on config
I added
ErrorDocument 404 /error/index.php
to the .htaccess and it did produce the Moodle error page instead of a simple server 404. However - the result with the redirect was not as expected...
#/importantquiz/#=>/mod/quiz/view.php?id=18
Translation: "404: file not found. An unexpected error has occured, because a non-existant page was called."
(In case that makes a difference: It is Moodle 4.1)
from moodle-tool_redirects.
Ok this was actually a surprisingly deep rabbit hole but this is now all implemented in #15
If I have test config like this:
#\/vanity#=>/my/
then I get a redirect:
brendan@catau-bri-laptop0372 05:30:17 ~ $ curl -kI https://master.localhost/vanity
HTTP/1.1 303 See Other
...
X-Redirect-By: Moodle /admin/tool/redirects/classes/helper.php:119
Location: https://master.localhost/my/
from moodle-tool_redirects.
One caveat is that if you are using nginx then the error pages must be setup like this:
error_page 403 = /error/index.php
and not just like below (the moodle wiki was not like this and is now corrected)
error_page 403 /error/index.php
https://docs.moodle.org/dev/Error_pages
from moodle-tool_redirects.
Related Issues (15)
- Move redirect rules from config settings to dedicated table HOT 1
- Use after_config callback to redirect earlier in the bootstrap HOT 7
- PHP Notice during 3.7 -> 3.9 upgrade HOT 1
- No redirects happening HOT 2
- Migrate CI to reusable workflows HOT 1
- Add new capability to to let non-admin users (eg editing teachers, content managers etc) use noredirect param HOT 1
- Cant make my rules to work HOT 1
- Validate the regexes when saving the admin config
- Allow comments anywhere in the textarea
- Consider ditching the # or / delimiter in the regex
- Have a debug mode for testing the regexes HOT 1
- Allow regex capture groups so you can use them in the redirect url HOT 1
- prevent redirects when not logged into moodle HOT 6
- redirects parsing values after the argument
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from moodle-tool_redirects.