Need help with redirects.

This question is in relation to Cloudflare pages, probably using the Github integration.

If I wanted visitors to example.com + www.example.com permanently redirected to a subpath such as example.com/sub what would be the best way to do it?

I have found the 2 dev links below but I'm not sure what approach to take.

(1) https://developers.cloudflare.com/pages/configuration/redirects/

(2)
https://developers.cloudflare.com/rules/url-forwarding/
Cloudflare Docs
To use redirects on Cloudflare Pages, declare your redirects in a plain text file called _redirects without a file extension, in the output folder of
Cloudflare 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.
Was this page helpful?