You can use a Twig replace
filter in the email template to replace the URL with whatever you like. (I'm using this method myself because we have a similar problem on multi-site installs). To do this you'll need to be using custom templates for all system emails: Settings > Email > HTML Email Template
I'd set that to something like emails/index
, which could then be like this, routing out to separate template files depending on the emailKey
:
{# Craft has four predefined email keys:
account_activation
verify_new_email
forgot_password
test_email
... route to them here, or fallback to default
#}
{% include [
'emails/' ~ emailKey ?? null,
'emails/default'
] %}
Then emails/account_activation.twig
could be something like this using the replace filter on the link
variable:
{% extends 'emails/_emailLayout' %}
{% set lockscreenText = 'Activate your account' %}
{%- set heading -%}
Hi {{ user.friendlyName ?? 'there' }},
{%- endset -%}
{% block content %}
<p>Your account is now set up and ready to use, with your email address as your username.</p>
<p>To activate your account, click the following link:</p>
{% endblock %}
{% if link is not defined %}
{% set link = 'http://local.test' %}
{% endif %}
{% set buttonLink = link|replace('https://old.com/actions','https://new.com/actions') %}
{% set buttonText = 'Activate your account' %}
...while emails/_emailLayout
would have all the complicated mess of HTML that cross-client email requires.