Skip to content

Commit 7593445

Browse files
authored
Merge pull request #108 from mooore-digital/develop
Develop
2 parents cc9a152 + d450a5b commit 7593445

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

Processors/AfterHtml/FixHrefUrls.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,13 @@ public function process(string $html, $siteId): string
3131
$html = preg_replace_callback(
3232
'<a.*?href="('.str_replace('/', '\\/', preg_quote($base_url)).'.*?)".*?>',
3333
function ($matches) use ($base_url, $prefix) {
34-
return str_replace($base_url, '/' . $prefix . '/', $matches[0]);
34+
// * Only replace the matched string
35+
$new_url = str_replace($base_url, '/' . $prefix . '/', $matches[1]);
36+
37+
return str_replace($matches[1], $new_url, $matches[0]);
3538
},
36-
$html);
39+
$html
40+
);
3741
}
3842

3943
return $html;

0 commit comments

Comments
 (0)