Same site, different domain (alias for Onion Services)

How can I setup phpList to work as expected when pointing a distinct domain at it?

I have an existing phpList install that I’ve been using for years. For the privacy of my users, I’m now going through the process of adding a distinct .onion domain for all of my existing websites.

I’ve updated my apache config to include a ServerAlias line for the new .onion domain, and it loads my phpList site fine. The problem is that the contents of the html generated by phpList and sent back to my clients still reference the clearnet domain name of my site. How can I change this behaviour in phpList?

One solution would be for phpList to not hard-code domains into <a href="...">...</a> anchor tags, <img ... /> image tags, etc. Instead, if the code changed from

<a href="https://phplist.example.com/lists/?p=unsubscribe&id=2">Unsubscribe</a>

to the following:

<a href="/lists/?p=unsubscribe&id=2">Unsubscribe</a>

…then the links on phpList would be domain-agnostic, and work perfectly for domain aliases, such as my use-case where I don’t want to point my users back to the clearnet domain.

Alternatively, phpList could expose some function hooks that could be overridden with some regex, as is done with wordpress using add_filter():

Please let me know if it’s possible to setup phpList with multiple distinct domains for the same site, such that the phpList doesn’t inject the wrong domain into the html content.