Need help with CF redirect page rules

Hi - I have a client that migrated their site to a new domain and wants to point their old domain to the new domain. However, they also want to use the old domain to keep a couple of pages/directories as well as the home page. Is it possible to set up the following page rules like:

olddomain > olddomain
olddomain/directory1 > olddomain/directory1
olddomain/directory2/slug1 > olddomain/directory2/slug1

all other olddomain/samepagepaths > newdomain/samepagepaths

Basically I need to redirect everything to new domain (keeping page path) except the home page and a few other page/directories.

Is this possible?

That’s four rules. Free plans only get three, but for $5/month, you can get more rules. Here’s a rough outline, and thankfully you have yours in the right order:

  1. Match old.com/ – Setting: Cache Level (Standard) This is a placeholder rule that really doesn’t change anything, but will trigger before the final rule that sends everything else to the new domain.
  2. Match old.com/directory1/* – Setting: Cache Level (Standard)
  3. Match old.com/directory2/slug/* – Setting: Cache Level (Standard)
  4. Match old.com/* – Setting: Forwarding URL (301) https://new.com/$1 ($1 will carry over everything from the * wildcard)

An extra note on rule priority: When a placeholder rule triggers, no other rule will be executed. So a request for old.com/ will deliver the content from old.com/. Same with those two directory rules. But if someone requests old.com/directory3/something/, it will skip the first three rules because it doesn’t match, then hit the fourth rule and get redirected to the new domain.

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