Improved url detection mechanism