Placeholders redirects not working

Examples of redirects with placeholders all have slashes between them. My URLs use dashes though to separate placeholders.

Below are the redirects I’m using, only the last one is working. For the first two, I’ve also tried replacing the :slug part for an asterisk (and :splat in the redirect rule) but didn’t have any luck either.

As an example, the following URL should be working but it’s returning a 404 instead:

Do you guys know what’s going on?

/blog/2019-:month-:day-:slug /blog/:slug 301!
/blog/2020-:month-:day-:slug /blog/:slug 301!
https://www.sexualidadeslibres.com.ar/* https://www.sexualidadeslibres.com/:splat 301!

Hi and welcome!

This is what the documentation says about placeholders:
A placeholder either matches a path segment from one / to the next / or matches a final path segment including a file extension but excluding a query string.

So I think you’re unfortunately out of luck trying to match dashes. You could solve it by proxying to a Netlify Function or using Edge Handlers, although I think Edge Handlers are not yet public (early access).

2 Likes