Improved URL path handling