Here is a quick post on how to find and replace relative links with absolute links using PHP Regular Expressions (regex).
$url = "http://myabsoluteurl.com/";
$ret = preg_replace('/((?:href|src) *= *[\'"](?!(http|ftp)))/i', "$1$url", $ret);
Here is a quick post on how to find and replace relative links with absolute links using PHP Regular Expressions (regex).
$url = "http://myabsoluteurl.com/";
$ret = preg_replace('/((?:href|src) *= *[\'"](?!(http|ftp)))/i', "$1$url", $ret);
Related posts:
Here is a simple tool that might be useful to others, it does two main things;
Post’s content errors
Each post’s content is wrapped with XML dummy tags and then passed with Microsoft’s XML parser. A feature of this parser is to check the XML structure when reading and output any errors. The WordPress Tool simply displays this raw output for each post. I have found it does do a good job of ‘typo’ errors, but depending on the content it may be erroneous, especially if you have code snippets and such.
Post’s external links
This was the main reason for designing this tool, I needed to extract all the links and confirm they met my ‘lowercase word hyphen word’ standard. You can export the links as a Tab delimited file, simply open it up in Excel.
How to use
Screenshots
Download
Related posts: