URL Rewrite Match Replace Tail PHP

<? $url = "documentation.form2content.com/f2c-field-types/image-gallery-field"; function addhttp($url) { if (!preg_match("~^(?:f|ht)tps?://~i", $url)) { $url = "http://" . $url; } return $url; } $real_url = addhttp($url); // Output $real_url = http://documentation.form2content.com/f2c-field-types/image-gallery-field $domain = str_ireplace('www.', '', parse_url($real_url, PHP_URL_HOST)); // Output $domain = documentation.form2content.com
Check for http:// in URL and get HOST for clean Anchor Links

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.