Smarter relative URL replacement system