How do I rewrite the old pages rules to new Redirect rules?

I already have a page rule that achieves the following redirection:

*.example.com/* uses a 301 redirect to:
https://$1.newpage.net/$2

where $1 and $2 are variables based on the accessed subdomain and path.

How can I use Redirect Rules to rewrite the above rule that is currently working correctly in the Page Rule?

Try this Dynamic redirect:

concat("https://",substring(http.host,0,-12),".newpage.net",http.request.uri.path)

It will concatenate:

  1. https://
  2. Remove the first 0 characters of the hostname, and remove the last 12 characters of the hostname (the .example.com), so you’re just left with the subdomain.
  3. The new domain.
  4. The path.
2 Likes

Thank you! worked!

1 Like

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