How to add a prefix to a WordPress post preview url?

I need to remove any query parameters from the WordPress post preview URL.

I need to access https://www.domain.com/prefix/12345 and see the same post preview I would see on https://www.domain.com/?p=12345preview=true

It can not redirect, the URL in the browser must still be https://www.domain.com/prefix/12345

As an alternative, adding a prefix to the original WordPress post preview url would also be enough: https://www.domain.com/previx/?p=12345preview=true

How can I achieve one of these without changing the URLs of the published posts?

The motivations is that I need a URL with a prefix to create a bypass route on CloudFlare Workers.

ps.: Cloudflare Page rules are different than Cloudflare Workers Routes. The Worker Routes does not support query parameters on it.

Topic cloudflare php plugins Wordpress

Category Web

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.