308 redirects for paths without trailing slash

Have followed discussion on the thread - https://community.cloudflare.com/t/cloudflare-pages-get-rid-of-redundat-308-redirect/324582 Is there any solution without adding functions for this, it affects page indexing in google search console. I am using this workaround atm - https://community.cloudflare.com/t/cloudflare-pages-disable-non-trailing-slash-308-redirect/316995/7
Cloudflare Community
Cloudflare Pages: get rid of redundat 308 redirect
I’m migrating our Gatsby project from Netlify to Cloudflare Pages. My website is currently hosted on Netlify We have had a clean URL structure on Netlify (without slash at the end) and I want to keep it that way for the best SEO performance. To achieve this on Netlify we just had to disable the “Pretty URL” option (can’t post a link, sorry). ...
Cloudflare Community
Cloudflare Pages: Disable Non-Trailing Slash 308 Redirect
Perhaps a pages function: function trailingSlashMiddleware({ request, next }) { const requestURL = new URL(request.url) if (requestURL.pathname.endsWith('/') ||requestURL.pathname.includes('.')) { return next() } requestURL.pathname += '/'; return next(new Request(requestURL)) }
0 Replies
No replies yetBe the first to reply to this messageJoin