How to set a page rule to redirect https://domain.com/subpage to https://domain.com/subpage/ with a "/" at the end?

Hello,
I have recently observed that my WordPress website is using an extra redirect to go from https://domain.com/subpage to https://domain.com/subpage/ with the “/” at the end.
The problem is that this redirect is adding extra time for loading the webpage.
Is there any page rule that I can set up so that all the URL’s redirects from non-"/" to “/” version is managed by Cloudflare only and not through my server so that the redirecting time is faster?
I have one extra page rule that I can apply. Your help will be greatly appreciated.
Thank you.

Greetings,

Thank you for asking.

Unfortunately, we cannot use regex like to ask and tell if end-trailing slash / does not exist then redirect to [/]? in a Page Rule, which would help in this case.

Maybe something could be done using Cloudflare Workers, but …

Otherwise, we could try to use recent feature Transform Rules → URL Rewrite, if so but I haven’t experimented with it in this particular case.

1 Like

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.