Code: Select all
?page=Review&movie=Happy Together
mailto:Tuna@acdrifter.com
/index.php?start_from=6&ucat=&archive=&subaction=&id=&
http://www.mozilla.org/products/firefox/start/Code: Select all
www.acdrifter.com/
www.acdrifter.com
http://www.acdrifter.com/
http://www.acdrifter.com
acdrifter.com/
acdrifter.com
any of the above with something like ?page=this page, or gallery/ at the end, etc.Transform all of the above url formats into http://www.acdrifter.com
Code: Select all
function createProperURL ( $link ) {
$regexFullURL = "e;#(?:(http://))?(?:(www\.))?(\w+)(?:(\.їa-z]+))?(?:(/))?(?:(.+))?#i"e;;
preg_match( $regexFullURL, $link, $parts );
// No domain or extension (.com,.net,etc.)
if ( !isset($partsї3]) || !isset($partsї4]) )
return false;
$newUrl = "e;http://www.{$partsї3]}{$partsї4]}"e;;
// This is for the post domain stuff, i.e. index.php?page=News
if ( isset( $partsї6] ) )
$newUrl .= "e;/{$partsї6]}"e;;
// Deal with subdomains
if ( preg_match( "e;#http://www\.(\w+)\.(\w+)/(\..+)#i"e;, $newUrl, $parts ) )
$newUrl = "e;http://www.{$partsї1]}.{$partsї2]}{$partsї3]}"e;;
return $newUrl;
}convert those links above into:
Code: Select all
http://www.acdrifter.com/?page=Review&movie=Happy Together
mailto:Tuna@acdrifter.com
http://www.acdrifter.com/index.php?start_from=6&ucat=&archive=&subaction=&id=&
http://www.mozilla.org/products/firefox/start/