Skip to content
Grav 2.0 is officially stable. Read the announcement →

Community guidelines

Please keep discussions civil and on-topic. Repeated violations may lead to a temporary ban.

Support

Redirect working but not route

Started by nix 4 years ago · 4 replies · 496 views
4 years ago

Hello,

I'd like to route an url sonicprotest.com/2022/le-replay to a folder sonicprotest.com/2022-le-replay
This folder is static html content.

When I define a redirect in configuration->site it is working as expected, when you type sonicprotest.com/2022/le-replay you are redirected to the folder with a visible changed URL.

But when I try to route it, it gives me a 404. However I defined redirect or routing the same way with:
/2022/le-replay: /2022-le-replay/

Do you know what I am doing wrong?
Thanks
Nicolas

4 years ago

Redirect physically redirects you. Routing approach doesn't know you want to load a physical folder and it still tries to load a page on /2022-le-replay, which does not exist. Redirect and re-route are two completely different things and should be used depending on what you actually need

4 years ago

OK thanks. I would like to display the content of the /2022-le-replay/index.html page when accessing the /2022/le-replay url. That's why redirect is not good in this case and I was expecting route to be the solution...

I tried as well editing .htaccess at the root level with RewriteRule ^/2022/le-replay$ /2022-le-replay/ [L] but it didn't work...

4 years ago

Was about to suggest .htaccess, but if it didn't work, then don't know. I'm no good at configuring servers and similar stuff 🙂

4 years ago

Hi @Nix through the internal mechanism in user/system/site.yaml I managed sometimes ago and it was working perfectly (old discuss)
have you try something like
/2022/le-replay/*.htm : /$1-$2/*.htm

Suggested topics

Topic Participants Replies Views Activity
Support · by Thomas, 1 week ago
2 57 15 hours ago
Support · by Anna, 3 days ago
2 65 18 hours ago
Support · by Justin Young, 18 hours ago
1 33 18 hours ago
Support · by Duc , 1 week ago
2 68 5 days ago
Support · by Colin Hume, 1 week ago
2 60 6 days ago