einaregilsson / Redirector

Browser extension (Firefox, Chrome, Opera, Edge) to redirect urls based on regex patterns, like a client side mod_rewrite.
http://einaregilsson.com/redirector/
MIT License
1.5k stars 153 forks source link

[Feature request] Custom variables #391

Open Cothlory opened 1 month ago

Cothlory commented 1 month ago

I have created more than 10 redirector rules that involves the same domain name of a self-hosted service. If the service is down, I will have to switch to another domain, which requires me to modify each redirector rule one by one. If there is a feature that enables me to define variables and refer to them in the redirector rules, I can simply define a variable whose content is the domain name. Then I can use that variable in my redirector rules, and changing the domain name would be as simple as changing the definition of the variable instead of changing the redirector rules.

We can add a section where variables can be defined by the user. In the redirector rules, one can use the variables by writing in something like $variableName.

Gitoffthelawn commented 1 month ago

That's a fascinating idea.

As a less-than-ideal workaround, you can:

  1. export your rules
  2. use a text editor's find and replace function to make the change
  3. import your rules

That's obviously not as neat and clean as your recommendation, but hopefully it can help you right now. 👍🏾

The bonus is that it forces you to make a backup of your rules, which is always a good idea.