Skip to content

Conversation

@shigahi
Copy link
Collaborator

@shigahi shigahi commented Jan 22, 2026

Summary

Add configurable URL redirect rules for SEO and URL migration purposes.

Changes

  • Add RedirectRule interface to code.ts
  • Add REDIRECT_RULES configuration in generated Worker script
  • Implement redirect handling in fetchAndApply function (before other routing)
  • Add "URL Redirect Rules" UI section in Advanced Settings

Implementation Details

  • Redirects are processed early in the request flow, after subdomain redirects
  • Supports both internal paths (/new-page) and external URLs (https://...)
  • Toggle between 301 (permanent) and 302 (temporary) redirects

UI Changes

Added "URL Redirect Rules" section in Advanced Settings with:

  • From path input
  • To path/URL input
  • 301/302 toggle switch
  • Add/remove buttons

Use Cases

  • URL restructuring while preserving SEO
  • Migrating from another platform
  • Shortening URLs for marketing campaigns
  • Handling common typos/variations

Closes #32

- Add RedirectRule interface to code.ts
- Add REDIRECT_RULES configuration in generated Worker script
- Implement redirect handling in fetchAndApply function
- Add URL Redirect Rules UI section with from/to/permanent fields

Closes #32
@shigahi shigahi merged commit 34fe76f into master Jan 22, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add custom redirect rules (301/302)

2 participants