Parse URL more robustly (handle params, etc)