Hi, @samwilson, I think you are expecting a placeholder named :tag which matches <insert placeholder here >.rss. Instead the placeholder is :tag.rss and it matches any single path segment URL.
For these paths:
/foo.rss
/foo.css
/foo.html
This redirect will match all of everything after the “/” and store it in a placeholder named :tag.rss. This is what will match of each one above:
foo.rss
foo.css
foo.html
A placeholder will match everything between two “/” characters or from a “/” to the end of the path (up to but not including any GET parameters in the URL). It matches a whole “path segment”.
The redirect rule makes a placeholder named :tag.rss which matches anything with has only the initial “/” and no other path segments. It does not match URLs with more than one path segment.
For this URL:
https://freosam.netlify.com/foo
The placeholder named :tag.rss is matching the first path segment which is the “foo” in /foo. Then on the target side of the redirect, the placeholder of :tag.rss is replaced with foo and redirecting to /tags/foo.
To summarize, the placeholder cannot match only a portion of a path segment, it must match the whole segment or nothing.
Came here trying to figure out if I could leverage a placeholder to match something before an image extension, i.e.
I want to redirect /people/luke.png to https://domain.com/luke/128.png
But it sounds like this is not possible because a placeholder only matches what’s between / marks:
# this will redirect `/people/luke.png` to `https://domain.com/luke.png/128.png`
/people/* https://domain.com/:splat/128.png
# this is kind of what I would hope for, but wouldn't work
/people/:luke.png https://domain.com/:luke/128.png
A placeholder will match everything between two “/” characters or from a “/” to the end of the path (up to but not including any GET parameters in the URL)
So useful, that I could’ve skipped scouring the community if the “Placeholders” docs had stated this. Might be useful to add that bit of clarity in the docs?
Howdy @jimniels! We have filed a feature request for this and linked this thread to it. If we end up implementing this functionality, we will let you know!