Published in: PHP
function is_valid_url($url) { $pattern = "#^(http:\/\/|https:\/\/|www\.)(([A-Z0-9][A-Z0-9_-]*)(\.[A-Z0-9][A-Z0-9_-]*)+)(:(\d+))?(\/)*$#i"; return false; } else { return true; } }
Comments
Subscribe to comments
You need to login to post a comment.

This method returns false for valid urls extending beyond the host:
isvalidurl('http://logankoester.com/') => bool(true) isvalidurl('http://logankoester.com/blog') => bool(false)