Redirect with page rule

Hello

I change primary link
from : mydomain .com/2021/04/sample-post/
to : mydomain.com/sample-post/

but when user open mydomain .com/2021/04/sample-post/ don’t redirect it to new path mydomain .com/sample-post/

How i can make true redirect from cloudflare page rule ?

Note: i make page rule code but not working fine, the code redirect mydomain .com/2021/04/sample-post/ to : mydomain .com/sample-post/

But when open example mydomain .com/blog/page/3 redirect me to wordpress dashboard

The code : Screenshot by Lightshot

Unless you’re on a Business or Enterprise plan, you can’t pattern match and strip out the middle of the pattern.

The only thing I can think of is Match example.com/2021/*/* and then redirect it to example.com/$2
That will force redirects only on dated posts. The disadvantage is you’d have to make a page rule for each year you’re trying to redirect.

If you’re running Apache, you’d have more flexibility with .htaccess

If you’re good with Javascript, you can do this with Workers ($5/month package)

https://developers.cloudflare.com/workers/examples/bulk-redirects

Another option is using a WordPress redirect plugin. I believe some of them will do pattern matching.

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