Skip to main content

How to Set Up URL Redirects in Cloudflare for a Reverse Proxy Treez Ecommerce Migration

Written by Treez Support

When migrating to a new e-commerce provider, itโ€™s common for menu or storefront URLs to change. To avoid broken links and help preserve SEO rankings, you should set up redirects from the old URLs to the new ones.

This guide walks through how to create redirects in Cloudflare using Redirect Rules.


Example Scenario

Old URL

https://example.com/shop/?location_id=12345&menu_type=pickup

New URL

https://example.com/menu/shop/?store=downtownstore

Goal:

  • Automatically send users visiting the old URL to the new URL

  • Preserve traffic and search engine indexing during migration


Option 1: Create a Simple Redirect Rule

This method works best when:

  • You only have a small number of redirects

  • Each old URL maps to one specific new URL

Step 1: Log Into Cloudflare

Go to:

  1. Select your website/domain.


Step 2: Navigate to Redirect Rules

In the left navigation:

Rules โ†’ Redirect Rules

Click:

Create Rule

Step 3: Configure the Match Conditions

Set the incoming request conditions.

Example:

Hostname equals example.com
AND
URI Path equals /shop/

You can optionally match query parameters if needed.


Step 4: Configure the Redirect

Choose:

Static Redirect

Enter your destination URL:

https://example.com/menu/shop/?store=downtownstore

Select:

301 Permanent Redirect

A 301 redirect tells search engines the page has permanently moved.


Step 5: Save and Deploy

Click:

Save and Deploy

Your redirect should now be active.


Testing the Redirect

After deployment:

  1. Open the old URL in a browser

  2. Confirm it automatically forwards to the new URL

  3. Verify the final URL loads correctly

You can also test with online redirect checkers or browser developer tools.


When to Use Dynamic Redirects Instead

If your old platform uses unique IDs for many locations or stores, manually creating redirects may not scale well.

Example:

Old Parameter

New Store Slug

location_id=12345

downtownstore

location_id=67890

uptownstore

In this case, consider using:

  • Cloudflare Workers

  • Bulk Redirects

  • Dynamic mapping logic

This allows one redirect system to handle many store mappings automatically.


SEO Best Practices During Migration

To reduce traffic loss during an e-commerce migration:

Recommended

  • Use 301 redirects

  • Keep redirects active for at least 12 months

  • Avoid redirect chains

  • Update internal links

  • Update XML sitemaps

  • Resubmit sitemaps in Google Search Console

  • Preserve page titles and metadata where possible

Avoid

  • Redirecting all pages to the homepage

  • Using temporary (302) redirects

  • Changing URL structure multiple times during migration


Additional Notes

Cloudflare Redirect Rules are ideal for:

  • Lightweight redirect management

  • Reverse proxy migrations

  • E-commerce platform transitions

  • Store URL restructuring

For more advanced routing or parameter handling, Cloudflare Workers provide additional flexibility.

Did this answer your question?