Realpath doesn't work so good with relative urls