Skip to content

Instantly share code, notes, and snippets.

@shmaltorhbooks
Created September 25, 2015 11:32
Show Gist options
  • Save shmaltorhbooks/0ba552c2e4909950339d to your computer and use it in GitHub Desktop.
Save shmaltorhbooks/0ba552c2e4909950339d to your computer and use it in GitHub Desktop.
Convert relative links to absolute path in href/src attributes
preg_replace('/((?:href|src) *= *[\'"](?!(\/\/|#|http|ftp)))/i', '$1' . $this->url, $value)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment