redirects not working with trailing slash inputs
I have an astro site hosted on cloudflare pages. The url scheme changed recently to move blog posts from the root to their own blog subdirectory (http://example.com/post -> http://example.com/blog/post). As such, I'm trying to set up redirects from the old post urls to the new ones, but unfortunately, the redirects are not working for inputs which have a trailing slash. For example, example.com/post will redirect to example.com/blog/post, but example.com/post/ will not. I've tried both astro's configureable redirects as well as the _redirects page for pages, but no luck. Does anyone have thoughts on how I might solve this?
3 Replies
One additional option to consider would be bulk redirects or redirect page rules
https://developers.cloudflare.com/rules/url-forwarding/
Cloudflare Docs
Redirects · Cloudflare Rules docs
URL forwarding, also known as URL redirection, navigates the user from a source URL to a target URL with a specific HTTP status code.
is it free to use astro on Cloudflare when you have just a $10 a year domain name, like inside th free pages thing ?
@ballsnfalls - yes, the free plan is quite generous and includes 100 pages projects
more details about limits for the free plan are described in https://developers.cloudflare.com/pages/platform/limits/
see also https://www.cloudflare.com/plans/ (click on Pages on the left)
Cloudflare Docs
Limits · Cloudflare Pages docs
Below are limits observed by the Cloudflare Free plan. For more details on removing these limits, refer to the Cloudflare plans ↗ page.
Our Plans | Pricing | Cloudflare
Discover which Cloudflare plan is correct for your requirements. Find out more about Cloudflare plan pricing and sign up for Cloudflare here!