I’m also experiencing the same issue. I have a _redirects
file containing:
/blog/* https://my-blog-app.netlify.com/:splat 200
Before Netlify, I was using GitHub pages for deployment of static pages, and if a user would navigate to /blog, they would be redirected to /blog/ so all the relative paths to assets like CSS and JavaScript are correct.
On Netlify this does not happen. The user stays on /blog, and all the relative URLs are now broken rendering the page without CSS and JavaScript.
After reading everything about redirects and trailing slashes (Redirect options | Netlify Docs) on netlify I came across the “Pretty URL” feature which promises: “Rewrite link URLs to pretty URLs (/about.html → /about, /about/index.html → /about/)”. This does nothing unfortunately. Why is this mentioned in the redirect docs if it does nothing for redirects?
What this means, to repeat what @brianzelip said earlier:
This means that Netlify cannot be used as a replacement for what GitHub Pages provides in this matter. Using GH Pages, I had the base custom domain (zelip.me) set from my brianzelip.github.io repo, and any other repo I set to be published via Pages, was available at zelip.me/*. In that GH Pages case, no matter if there was a trailing slash or not, EVERYTHING WORKED as expected.
Hopefully there is an ongoing feature request for this already, but I would like to be able to enable “redirect to trailing slash” feature for redirects. The same way GitHub pages/CDN behaves.
There are also a bunch of people using Gatsby that are having issues with this, you can follow the discussion over at their GitHub repo: Preventing 301 redirects on URLs with no trailing slashes (Netlify) · Issue #9207 · gatsbyjs/gatsby · GitHub
Regards,
Daniel
Edit: Upon further investigation I realised the “Pretty URL” does help for the rest of the page: eg /about does indeed redirect to /about/ (if about is a directory containing a index.html file), now if only the same could apply for redirects!