Skip to content

rxliuli/redirector

Repository files navigation

Redirector

Introduction

Redirector is a powerful and flexible browser extension that allows users to customize URL redirection rules. Using regular expressions, users can create complex redirection rules applicable to various websites and URL patterns.

Key Features

  • Create custom redirection rules using regular expressions
  • Support for multiple redirection rules
  • Real-time URL match testing
  • Intuitive user interface for easy addition, editing, and deletion of rules
  • Support for wildcards and complex URL patterns

Installation

Install from the Chrome Web Store.

How to Use

  1. Click on the Redirector icon in the browser toolbar to open the options page
  2. In the "Add a redirect URL" section:
    • Enter the source URL pattern (using regular expression) in the left input box
    • Enter the target URL in the right input box (you can use $1, $2, etc., to reference capture groups in the regular expression)
    • Click the "Add" button to add a new rule
  3. You can test your redirection rules in the "Test URL" section
  4. Added rules will be displayed in the "Rules" list, where you can delete unnecessary rules at any time

Example Rule

Regular expression is a powerful tool for matching URL patterns. Here are some examples:

  • Redirect Google search to DuckDuckGo:
    • From: ^https://www.google.com/search\?q=(.*?)&.*$
    • To: https://duckduckgo.com/?q=$1

URLPattern is a more powerful and flexible tool for matching URL patterns. Here are some examples:

  • Redirect Google search to DuckDuckGo:
    • From: ^https://www.google.com/search?q=:id
    • To: https://duckduckgo.com/?q={{search.groups.id}}

Reference: https://developer.mozilla.org/en-US/docs/Web/API/URLPattern/URLPattern

Glob pattern is a simple pattern matching tool. Here are some examples:

  • Redirect all YouTube videos to a specific page:
    • From: https://youtu.be/*
    • To: https://example.com/watch?v=$1

Privacy

This extension processes all redirection rules locally and does not collect or transmit any user data.

Contributions

Contributions are welcome! If you have any suggestions for improvements or have found a bug, please open an issue or submit a pull request.

License

MIT License

Contact

If you have any questions or suggestions, please contact us at [email protected].