Fixing absolute URLs for empty urls

Empty urls are now handled properly as well as relative "./" or "." urls

@tractorcow

re #3323 and #3345
Are you able to fix only the issue you noted and only use less code? The simpler the function is the easier it'll be to maintain in the future.