encode history URLs