Skip to content

Rewrite a link before it opens

A rewrite changes part of a link before Bouncer opens it. Use it to send a Twitter link to xcancel, for example.

  1. Enter a real link in Example link:.
  2. Click Advanced matching with regex under When….
  3. Enter a pattern that matches only the part you want to change.
  4. Enter the new text in Replace with. The hint text is $1, $2....
  5. Read the preview under the field. It shows the example link after the change.
  6. Click Save Rule. If you opened the editor from the menu bar, click Save & Reopen to open the rewritten link now.

Bouncer replaces the part of the link that the pattern matched. Everything else stays. The result must still be a valid link.

This is the Twitter/X → xcancel preset:

  • When…: ://(www\.)?(twitter\.com|x\.com)
  • Replace with: ://xcancel.com

With the example link https://twitter.com/octave/status/123, the preview reads https://xcancel.com/octave/status/123. Only ://twitter.com changed.

If the replacement leaves the link unchanged, Bouncer opens the link as it was.

Put parentheses around a part of the pattern to capture it. Then use $1 in Replace with to insert that part. $2 is the second pair of parentheses. $0 is the whole match.

  • When…: twitter\.com/(.*)
  • Replace with: xcancel.com/$1

With the example link https://twitter.com/octave/status/123, the parentheses capture octave/status/123. The preview reads https://xcancel.com/octave/status/123.

Bouncer rewrites the link first. Then it opens the result in the browser, profile, or app under Open in….

For more syntax, see the Regex and rewrite cheat sheet.