In config/development/server.yaml I have the following:
redirects:
- from: /docs/pyrosim/latest/*
status: 200
to: /docs/pyrosim/2020-4/:splat
- from: /docs/pathfinder/latest/*
status: 200
to: /docs/pathfinder/2020-4/:splat
When I try to run server I get the error:
Error: unspported redirect to value "/docs/pyrosim/2020-4/:splat" in server config; currently this must be either a remote destination or a local folder, e.g. "/blog/" or "/blog/index.html"
Is there a way to use the splat string to represent the asterisk as I do in my Netlify redirects file?
That :splat is a Netlify specific command. Itās probably better to go away from that and make the proposal about a proper redirect command that is able to redirect (.*) by using $1 like the Apache config has.
Maybe that here will help you: I have a repo where I create redirect files for Netlify via Hugo posttype.
This will not create single redirect command, but you could use it to create redirects for every single post.
" Itās probably better to go away from that and make the proposal about a proper redirect command that is able to redirect (.*) by using $1 like the Apache config has."
This is a fine idea, I donāt really care much about the syntax, I really just want the same or similar functionality in the redirects feature.
Iāll check out your repo in the meantime, thank you for the link.
I added a basic redirect feature similar to Netlify to get URL rewrites to support SPA like situations.
I donāt know the use case for :splat is, but if we would add something like that it would need to be really simple (since it seems that itās me ho will have to maintain it (and possibly implement it))
The simple use case for me is to capture the portion of the URL from the asterisk to the end and append that to the end of the ātoā URL. I donāt need anything else. I need to rewrite the beginning part of the URL before the * and donāt require multiple placeholders, RegEx, etcā¦
In my case, I have a documentation website, where we update the redirects in Netlify for ālatestā to point to a specific version (path) of the URL.
Example: http://localhost:1313/docs/pyrosim/latest/user-manual/
would point to: http://localhost:1313/docs/pyrosim/2020-4/user-manual/
In my Netlify _redirects file I have the following two lines to handle this.
When we release the next version of our documentation, we update this file to the new version number. Some of our other ātutorialsā and ātrainingā resources point to the ālatestā URL. We want to be able to check for broken links and click through the site when running the Hugo server and have it work the same as on Netlify.