Good day to all! I have a problem with redirect in GRAV. I have read documentation, but in the chapter “redirects” there are no information about in what file I should to write the rule for redirect. I tried to write redirect in the header of the page “default.md”, in the file ‘site.yaml’ and in the ‘system.yaml’, but it didn’t work:
I can visit the page “/tutorial/algebra/fractions” without redirecting to the page ‘/tutorial/algebra/fractions/theory’. Tell me please, where I made a mistake?
Hi @Gray_and_Big, I have not used system.yaml or site.yaml for redirects but have used the page header
Here is an example of a redirect from
Hope the above helps,
The docs do say “you can override or add any of your own settings by editing the
user/config/site.yaml file” under the heading “Site Level Routes and Redirects”. You must have missed that.
If it’s still not working, could you expand on what “it didn’t work” means exactly i.e. what is happening?
Good luck, cheers
Thanks a lot, your advice was very useful for me
Thanks for your answer, I really missed some information above the chapter “Redirects”.
I tried to create page structure like this:
So I made this folder structure:
But I didn’t want to make separate page on site for the chapter “Fractions”. When user cliks on “Fractions” it has to redirect to the “Fractions\Theory”. So I wrote the rule for routing in the header of the file “Tutorial/01.algebra/01.fractions/default.md”
It worked, but another problem appeared. I suddenly found that the page “/tutorial/algebra/fractions/theory” opens on the link “/tutorial/algebra/fractions/theory/theory”, and the page “/tutorial/algebra/fractions/practice” opens by the link “/tutorial/algebra/fractions/theory/practice”. I was really surprised, because I wrote the rule for routions only for one page. After that happened I tried to found the rule for redirect I wrote redirect in the file default.md in the folder “Fractions”, in the file site.yaml and system.yaml, but redirect didn’t work. Now I understand, that my mistake was that I wrote redirect like this (I copied this example from documentation):
But correct rule for redirect is this:
What if you don’t put a
default.md file in your
01.fractions folder ?
I deleted the default.md file from folder ‘01.fractions’ and received 404-error when pressed ‘Fractions’ in the main menu of the site.