Pretty URL + Redirect Conflicts?

I have my site getting ultimately being compiled across a few repositories. We are gluing it together with the following redirect rules in our Netlify config.

The site is at https://get.foundation

[[redirects]]
  from = "/sites/docs/*"
  to = "https://foundation-sites.netlify.com/:splat"
  status = 200
  force = true
  [redirects.headers]
    X-From = "Netlify"

[[redirects]]
  from = "/emails/docs/*"
  to = "https://foundation-emails.netlify.com/:splat"
  status = 200
  force = true
  [redirects.headers]
    X-From = "Netlify"

This works really well. It makes the site pretty seamless. However, if you visit the following URL, pretty URLs does not kick in if you visit one of the above redirect rules without a trailing slash.

What can I do to get those redirected so that the trailing slash is added?

1 Like

Unfortunately, manipulating trailing slashes directly on our platform is quite hard. I’m not sure there’s anything you can do to affect it on the server side.

You could try adding two more redirects for the specific slashless path, if you had the content in subfolders already. Note however that it wouldn’t help the way you have things configured now to redirect to / rather than /subfolder (where you could change /subfolder to /subfolder/):

[[redirects]]
  from = "/sites/docs"
  to = "https://foundation-sites.netlify.com/sites/docs/"
  status = 200
  force = true
  [redirects.headers]
    X-From = "Netlify"

[[redirects]]
  from = "/emails/docs"
  to = "https://foundation-emails.netlify.com/emails/docs/"
  status = 200
  force = true
  [redirects.headers]
    X-From = "Netlify"