Redirecting WWW to non-WWW with Transform Rules and/or Bulk Redirects

Is it possible to redirect WWW to non-WWW with transform rules and/or bulk redirects?

Thanks

With PageRules it is possible, just go for a PageRule (forward url) like this:

source_url: www.example.com/*
http_code: 302
target_url: https://example.com/$1

If it worked change the http_code to 301.

That should do the job

Yes, I know I can do that with page rules, but is it possible with transform rules and/or bulk redirects?
Because I would like to free up one space in page rules.

With transform tules not that I am aware of, but someone may know some trick.

With bulk redirects it should be possible again.

Another way to do it, is described here: https://blog.cloudflare.com/maximum-redirects-minimum-effort-announcing-bulk-redirects/

Another method is to use Cloudflare Workers to implement URL redirects, either individually or as a map. For example, the code below is used to create a URL redirect map which runs when the Worker is invoked:

const redirectMap = new Map([
 ["/bulk1", "https://" + externalHostname + "/redirect2"],
 ["/bulk2", "https://" + externalHostname + "/redirect3"],
 ["/bulk3", "https://" + externalHostname + "/redirect4"],
 ["/bulk4", "https://google.com"],
])

This snippet is taken from the Cloudflare Workers examples library and can be used to scale beyond the 125 URL redirect limit of Page Rules. However, it does require the administrator to be comfortable working with code and correctly configuring their Cloudflare Workers.

There also is written about how to use bulk redirects :slight_smile:

2 Likes

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