[ticket/12440] Use a more generic approach for replacing the URL.

PHPBB3-12440