Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Make links within a website root relative
<?php
function make_href_root_relative($input) {
return preg_replace('!http(s)?://' . $_SERVER['SERVER_NAME'] . '/!', '/', $input);
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment